in edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Diagnostics/MetricsWorker.cs [38:111]
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader)
{
this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper));
this.storage = Preconditions.CheckNotNull(storage, nameof(storage));
this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader));
this.metricFilter = new MetricTransformer()
.AddAllowedTags((MetricsConstants.MsTelemetry, true.ToString()))
.AddDisallowedTags(
("quantile", "0.1"),
("quantile", "0.5"),
("quantile", "0.99"))
.AddTagsToRemove(MetricsConstants.MsTelemetry, MetricsConstants.IotHubLabel, MetricsConstants.DeviceIdLabel)
.AddTagsToModify(
("id", this.ReplaceDeviceId),
("module_name", this.ReplaceModuleId),
("to", name => name.CreateSha256()),
("from", name => name.CreateSha256()),
("to_route_input", name => name.CreateSha256()),
("from_route_output", name => name.CreateSha256()));
#pragma warning disable SA1111 // Closing parenthesis should be on line of last parameter
this.metricAggregator = new MetricAggregator(
new AggregationTemplate("edgehub_gettwin_total", "id", new Summer()),
new AggregationTemplate(
"edgehub_messages_received_total",
("route_output", new Summer()),
("id", new Summer())
),
new AggregationTemplate(
"edgehub_messages_sent_total",
("from", new Summer()),
("to", new Summer()),
("from_route_output", new Summer()),
("to_route_input", new Summer())
),
new AggregationTemplate(
new string[]
{
"edgehub_message_size_bytes",
"edgehub_message_size_bytes_sum",
"edgehub_message_size_bytes_count"
},
"id",
new Averager()),
new AggregationTemplate(
new string[]
{
"edgehub_message_process_duration_seconds",
"edgehub_message_process_duration_seconds_sum",
"edgehub_message_process_duration_seconds_count",
},
("from", new Averager()),
("to", new Averager())
),
new AggregationTemplate(
"edgehub_direct_methods_total",
("from", new Summer()),
("to", new Summer())
),
new AggregationTemplate("edgehub_queue_length", "endpoint", new Summer()),
new AggregationTemplate(
new string[]
{
"edgehub_messages_dropped_total",
"edgehub_messages_unack_total",
},
("from", new Summer()),
("from_route_output", new Summer())
),
new AggregationTemplate("edgehub_client_connect_failed_total", "id", new Summer())
);
#pragma warning restore SA1111 // Closing parenthesis should be on line of last parameter
}