public void ScopeMetric(Action <MetricMessage> metric, IDictionary <string, string> scopeProperties = null, IDictionary <string, string> properties = null) { telemetryScopedProperties.SetScopeProperties(scopeProperties); var saveScoped = RouteBinding?.Logging?.ScopedLogger?.LogMetric == true; var saveScopedStream = RouteBinding?.Logging?.ScopedStreamLoggers?.Where(l => l.LogMetric).Any() == true; if (saveScoped || saveScopedStream) { var messageData = new MetricMessage(); metric(messageData); if (saveScoped) { telemetryLogger.Metric(messageData.Message, messageData.Value, properties); } if (RouteBinding?.Logging?.ScopedStreamLoggers?.Count > 0) { foreach (var scopedStreamLogger in RouteBinding.Logging.ScopedStreamLoggers.Where(l => l.LogMetric)) { telemetryScopedStreamLogger.Metric(scopedStreamLogger, messageData.Message, messageData.Value, telemetryScopedProperties.Properties.ConcatOnce(properties)); } } } }
public void ScopeMetric(string message, double value, IDictionary <string, string> scopeProperties = null, IDictionary <string, string> properties = null) { telemetryScopedProperties.SetScopeProperties(scopeProperties); telemetryLogger.Metric(message, value, properties); tenantTrackLogger.Metric(message, value, telemetryScopedProperties.Properties.ConcatOnce(properties)); }