Exemplo n.º 1
0
        public async Task SuccessAsync(Replicatable replicatable, TimeSpan replicatedIn = default, CancellationToken cancellationToken = default)
        {
            var queuedTelemetry = new QueuedTelemetry
            {
                Name     = _telemetryConfiguration.QueuedTelemetryName ?? TelemetryConfigurationDefaults.QueuedTelemetryName,
                Duration = replicatedIn
            };

            queuedTelemetry.Metrics[_telemetryConfiguration.QueuedTelemetryMetricAggregatedCount ?? TelemetryConfigurationDefaults.QueuedTelemetryMetricAggregatedCount] = 1;

            queuedTelemetry.Metrics[_telemetryConfiguration.QueuedTelemetryMetricAggregatedDuration ?? TelemetryConfigurationDefaults.QueuedTelemetryMetricAggregatedDuration] = replicatedIn.TotalSeconds;

            if (replicatable.SizeInBytes.HasValue)
            {
                queuedTelemetry.Metrics[_telemetryConfiguration.QueuedTelemetryMetricAggregatedSize ?? TelemetryConfigurationDefaults.QueuedTelemetryMetricAggregatedSize] = (double)replicatable.SizeInBytes;
            }

            AddDiagnosticInfo(queuedTelemetry.Properties, replicatable.DiagnosticInfo);

            _telemetryQueue.Queue(queuedTelemetry);

            await Task.CompletedTask;
        }
Exemplo n.º 2
0
 public void Queue(QueuedTelemetry telemetry)
 {
     _telemetry.Enqueue(telemetry);
 }