ConfigurationData Class
Definition
A class that contains all telemetry configuration information.
public sealed class ConfigurationData : IDisposableInheritance object
Implements IDisposable
Constructors
ConfigurationData()
Initializes a new instance of the ConfigurationData class.
public ConfigurationData()Properties
ConnectionString
Gets the connection string used by Application Insights. Specifies where analytics should be sent.
public string ConnectionString { get; }DataCollectionMode
Gets an enum specifying what types of data should be automatically collected.
public CollectionMode DataCollectionMode { get; }MetricAggregationPeriod
Gets the length of time over which metrics should be aggregated before being sent to Application Insights.
public TimeSpan MetricAggregationPeriod { get; }MinimumSeverityLevel
Gets the minimum severity level to track for traces. Anything lower than this level will not be tracked.
public SeverityLevel MinimumSeverityLevel { get; }PersonallyIdentifiableCustomProperties
Gets a group of custom properties that should automatically be tracked as Personally Identifiable Information.
public IReadOnlyDictionary<string, string> PersonallyIdentifiableCustomProperties { get; }ConfigurationLocked
Gets a value indicating whether the configuration is Locked. If True, further changes to configuration are prevented.
public bool ConfigurationLocked { get; }Methods
TrackerCustomProperties(TrackerType)
Get a dictionary of dictionaries which contain custom properties for each of the specified tracker types.
public IReadOnlyDictionary<TrackerType, IReadOnlyDictionary<string, string>> TrackerCustomProperties(TrackerType trackerType)Parameters
trackerType TrackerType
The tracker types for which to return custom properties of.
Returns
IReadOnlyDictionary<TrackerType, IReadOnlyDictionary<string, string>>
Returns a dictionary of dictionaries of custom properties.
RequiredTrackerParameters(TrackerType)
Gets a dictionary of dictionaries which contain parameter names that are required to be passed as properties to all telemetry calls of the specified tracker types.
public IReadOnlyDictionary<TrackerType, IReadOnlyDictionary<string, RequiredParameterInfo>> RequiredTrackerParameters(TrackerType trackerType)Parameters
trackerType TrackerType
The tracker types for which to return the required parameters of.
Returns
IReadOnlyDictionary<TrackerType, IReadOnlyDictionary<string, RequiredParameterInfo>>
Returns a dictionary of dictionaries which contain required parameters.
Configure(string?, CollectionMode?, TimeSpan?, Severity?, bool?, Dictionary<string, RequiredParameterInfo>?, Dictionary<string, RequiredParameterInfo>?, Dictionary<string, RequiredParameterInfo>?, Dictionary<string, string>?, Dictionary<string, string>?, Dictionary<string, string>?, Dictionary<string, string>?, Dictionary<string, string>?, bool?)
Sets internal configuration data.
public void Configure(string? connectionString = null, CollectionMode? dataCollectionMode = null, TimeSpan? metricAggregationPeriod = null, Severity? minimumSeverityLevel = null, bool? developerMode = null, Dictionary<string, RequiredParameterInfo>? requiredExceptionParameters = null, Dictionary<string, RequiredParameterInfo>? requiredTraceParameters = null, Dictionary<string, RequiredParameterInfo>? requiredEventParameters = null, Dictionary<string, string>? globalCustomProperties = null, Dictionary<string, string>? exceptionCustomProperties = null, Dictionary<string, string>? traceCustomProperties = null, Dictionary<string, string>? eventCustomProperties = null, Dictionary<string, string>? personallyIdentifiableCustomProperties = null, bool? configurationLocked = null)Parameters
connectionString string
The connection string to be used across all tracking that is associated with the Application Insights target.
dataCollectionMode CollectionMode?
An Enum Flag specifying what types of additional data should be collected.
metricAggregationPeriod TimeSpan?
Specifies the length of time over which metrics should be aggregated before being sent to Application Insights.
minimumSeverityLevel Severity?
Specifies the minimum severity level to log for all Traces. Any Trace below this severity level will not be sent to Application Insights.
developerMode bool?
Specifies whether or not Application Insights should be run in Developer mode. Developer mode causes telemetry to be processed more rapidly.
requiredExceptionParameters Dictionary<string, RequiredParameterInfo>
A Dictionary of required parameter names that must be passed to all TrackException calls, where the key is the parameter name.
requiredTraceParameters Dictionary<string, RequiredParameterInfo>
A Dictionary of required parameter names that must be passed to all TrackTrace calls, where the key is the parameter name.
requiredEventParameters Dictionary<string, RequiredParameterInfo>
A Dictionary of required parameter names that must be passed to all EventException calls, where the key is the parameter name.
globalCustomProperties Dictionary<string, string>
A Dictionary of properties that are to be added to all Telemetry events.
exceptionCustomProperties Dictionary<string, string>
A Dictionary of properties that are to be added to all Exception Telemetry events.
traceCustomProperties Dictionary<string, string>
A Dictionary of properties that are to be added to all Trace Telemetry events.
eventCustomProperties Dictionary<string, string>
A Dictionary of properties that are to be added to all Event Telemetry events.
personallyIdentifiableCustomProperties Dictionary<string, string>
A Dictionary of properties that are to be added to all Telemetry events, but will not be added if the dataCollectionMode is not set to log Personally Identifiable Information.
configurationLocked bool?
Specifies whether the configuration should be locked after these changes. Locked configurations cannot be changed for the rest of execution.
GetDefaultContext()
Returns a DefaultTelemetryContext which implements ITelemetryContext with all required parameters set to their default values.
public DefaultTelemetryContext GetDefaultContext()Returns
DefaultTelemetryContext
A DefaultTelemetryContext object.
RegisterGlobalProperty(TelemetryClient, string, string)
Registers a global property which will be added to all telemetry events.
public void RegisterGlobalProperty(TelemetryClient appInsightsClient, string name, string value)Parameters
appInsightsClient TelemetryClient
The Application Insights client we want to register this global property with.
name string
The name of the property.
value string
The value of the property.
UnregisterGlobalProperty(TelemetryClient, string)
Attempts to unregister a global property.
public void UnregisterGlobalProperty(TelemetryClient appInsightsClient, string name)Parameters
appInsightsClient TelemetryClient
The Application Insights client we want to unregister this global property from.
name string
The name of the property to unregister.
RegisterPersonallyIdentifiableProperty(string, string)
Registers a PII property which will be added to all telemetry events if collection of Personally Identifiable Information is enabled.
public void RegisterPersonallyIdentifiableProperty(string name, string value)Parameters
name string
The name of the property.
value string
The value of the property.
UnregisterPersonallyIdentifiableProperty(string)
Attempts to unregister a PII property.
public void UnregisterPersonallyIdentifiableProperty(string name)Parameters
name string
The name of the property to unregister.
RegisterTrackerProperty(TrackerType, string, string)
Registers a property which will be added to all telemetry events of the specified tracker types, and only if collection of Custom Data is enabled.
public void RegisterTrackerProperty(TrackerType trackerType, string name, string value)Parameters
trackerType TrackerType
The tracker types for which to register this property.
name string
The name of the property.
value string
The value of the property.
UnregisterTrackerProperty(TrackerType, string)
Attempts to unregister a property for each of the specified tracker types.
public void UnregisterTrackerProperty(TrackerType trackerType, string name)Parameters
trackerType TrackerType
The tracker types for which to unregister this property.
name string
The name of the property to unregister.
RegisterRequiredTrackerParameter(TrackerType, string, RequiredParameterInfo)
Registers a required parameter for each of the specified tracker types.
public void RegisterRequiredTrackerParameter(TrackerType trackerType, string name, RequiredParameterInfo parameterInfo)Parameters
trackerType TrackerType
The tracker types for which to register the required parameter.
name string
The name of the required parameter.
parameterInfo RequiredParameterInfo
Additional information about the required parameter.
UnregisterRequiredTrackerParameter(TrackerType, string)
Attempts to unregister a required parameter for each of the specified tracker types.
public void UnregisterRequiredTrackerParameter(TrackerType trackerType, string name)Parameters
trackerType TrackerType
The tracker types for which to unregister the required parameter.
name string
The name of the required parameter to unregister.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()