示例#1
0
 public TelemetryReporterInfluxAttribute()
 {
     IMetricsReporterBuilder builder = new MetricsReporterBuilder(
          _activationFactory,
          _simpleConfig,
          _tagContext);
     _reporter = builder.Build();
 }
        public void Implement_Via_Config_Constrict_Test()
        {
            IReadOnlyDictionary <string, string> tags = new Dictionary <string, string>
            {
                ["operationName"]  = "X",
                ["operationGroup"] = "Y"
            };

            IMetricsReporterBuilder builder = new MetricsReporterBuilder(
                _activationFactory,
                _simpleConfig,
                _tagContext);

            _activationContext.PushFlow(CommonLayerOrService.WebApi, "Test-class", "test-method");
            _activationContext.PushToken("env", "qa");
            _tagContext.PushFlow(CommonLayerOrService.WebApi, "Test-class", "test-method-b");
            _tagContext.PushToken("env", "qa");
            _telemetryPushContext.PushToken("dry", "pushed-to-all");
            using (var reporter = builder.Build())
            {
                reporter.Count(ImportanceLevel.High, tags);
            }
        }