src/Arcus.Shared/Observability/Sinks/Converters/SuperCustomDependencyTelemetryConverter.cs
/// <summary>
///     Creates a telemetry entry for a given log event
/// </summary>
/// <param name="logEvent">Event that was logged and written to this sink</param>
/// <param name="formatProvider">Provider to format event</param>
/// <returns>Telemetry entry to emit to Azure Application Insights</returns>
Creates a telemetry entry for a given log event
Creates a telemetry entry for a given log event
protected override DependencyTelemetry CreateTelemetryEntry(LogEvent logEvent, IFormatProvider formatProvider)
        {
            var target = logEvent.Properties.GetAsRawString(ContextProperties.DependencyTracking.TargetName);
            var dependencyName = logEvent.Properties.GetAsRawString(ContextProperties.DependencyTracking.DependencyName);
            var data = logEvent.Properties.GetAsRawString(ContextProperties.DependencyTracking.DependencyData);
            var startTime = logEvent.Properties.GetAsDateTimeOffset(ContextProperties.DependencyTracking.StartTime);
            var duration = logEvent.Properties.GetAsTimeSpan(ContextProperties.DependencyTracking.Duration);
            var resultCode = logEvent.Properties.GetAsRawString(ContextProperties.DependencyTracking.ResultCode);
            var outcome = logEvent.Properties.GetAsBool(ContextProperties.DependencyTracking.IsSuccessful);
            var operationId = logEvent.Properties.GetAsRawString(ContextProperties.Correlation.OperationId);
            string dependencyType = GetDependencyType(logEvent);
            var dependencyTelemetry = new DependencyTelemetry(dependencyType, target, dependencyName, data, startTime, duration, resultCode, success: outcome)
            {
                Id = operationId,
            };
            return dependencyTelemetry;
        }
protected override DependencyTelemetry CreateTelemetryEntry ( LogEvent logEvent , IFormatProvider formatProvider ) { var target = logEvent . Properties . GetAsRawString ( ContextProperties . DependencyTracking . TargetName ) ; var dependencyName = logEvent . Properties . GetAsRawString ( ContextProperties . DependencyTracking . DependencyName ) ; var data = logEvent . Properties . GetAsRawString ( ContextProperties . DependencyTracking . DependencyData ) ; var startTime = logEvent . Properties . GetAsDateTimeOffset ( ContextProperties . DependencyTracking . StartTime ) ; var duration = logEvent . Properties . GetAsTimeSpan ( ContextProperties . DependencyTracking . Duration ) ; var resultCode = logEvent . Properties . GetAsRawString ( ContextProperties . DependencyTracking . ResultCode ) ; var outcome = logEvent . Properties . GetAsBool ( ContextProperties . DependencyTracking . IsSuccessful ) ; var operationId = logEvent . Properties . GetAsRawString ( ContextProperties . Correlation . OperationId ) ; string dependencyType = GetDependencyType ( logEvent ) ; var dependencyTelemetry = new DependencyTelemetry ( dependencyType , target , dependencyName , data , startTime , duration , resultCode , success : outcome ) { Id = operationId , } ; return dependencyTelemetry ; }
Creates a telemetry entry for a given log event
Creates a telemetry entry for a given log event
Telemetry entry to emit to Azure Application Insights
Telemetry entry to emit to Azure Application Insights
logEvent
LogEvent
Event that was logged and written to this sink
Event that was logged and written to this sink
formatProvider
IFormatProvider
Provider to format event
Provider to format event