Exemple #1
0
    public FactoryMetrics(IMetricsProvider metricsProvider)
    {
        this.commandCounters = Enum.GetValues(typeof(ModuleCommandMetric)).Cast <ModuleCommandMetric>().ToDictionary(c => c, command =>
        {
            string commandName = Enum.GetName(typeof(ModuleCommandMetric), command).ToLower();
            return(metricsProvider.CreateCounter(
                       $"module_{commandName}",
                       "Command sent to module",
                       new List <string> {
                "module_name", "module_version", MetricsConstants.MsTelemetry
            }));
        });

        this.commandTiming = metricsProvider.CreateDuration(
            $"command_latency",
            "Command sent to module",
            new List <string> {
            "command", MetricsConstants.MsTelemetry
        });
    }