// Constructor public MetricBuilder(MetricSource source, string measurement = null) { // TODO: [TESTS] (MetricBuilder.MetricBuilder) Add tests if (string.IsNullOrWhiteSpace(measurement)) { measurement = $"resolve:{source:G}"; } Measurement = measurement; UtcTimestamp = null; Tags = new Dictionary <string, string> { { CoreMetricTag.Source, source.ToString("G").LowerTrim() }, { CoreMetricTag.Success, "true" }, { CoreMetricTag.HasException, "false" }, { CoreMetricTag.ExceptionName, string.Empty } }; Fields = new Dictionary <string, object> { { CoreMetricField.Value, (long)0 }, { CoreMetricField.CallCount, 1 }, { CoreMetricField.UserId, 0 } }; }
private static void SetMeasurement(MetricsConfig config, MetricSource source, string builderType) { // TODO: [TESTS] (MetricService.SetMeasurement) Add tests var key = source.ToString("G"); if (config.Measurements.ContainsKey(key)) { return; } config.Measurements[key] = config.MeasurementTemplate .Replace("{type}", builderType); }