Condividi tramite


TelemetryContext.StoreRawObject(String, Object, Boolean) Method

Definition

Stores the raw object against the key specified. Use this to store raw objects from data collectors so that TelemetryInitializers can access them to extract additional details to enrich telemetry. Objects stored through this method are not automatically serialized and sent to the backend. They are shared (i.e not cloned) if multiple sinks are configured, so sinks should treat them as read-only.

public void StoreRawObject (string key, object rawObject, bool keepForInitializationOnly = true);
member this.StoreRawObject : string * obj * bool -> unit
Public Sub StoreRawObject (key As String, rawObject As Object, Optional keepForInitializationOnly As Boolean = true)

Parameters

key
String

The key to store the object against.

rawObject
Object

Object to be stored.

keepForInitializationOnly
Boolean

Boolean flag indicating if this object should be made available only during TelemetryInitializers. If set to true, then the object will not accessible in TelemetryProcessors and TelemetryChannel.

Remarks

This method is not thread-safe. Objects should be stored from Collectors or TelemetryInitializers that are run synchronously.

Applies to