private void ApplyApplicationTags() { if (applicationTags != null) { WithGlobalTags(applicationTags.ToPointTags()); } }
public void TestToPointTags() { var pointTags = applicationTags.ToPointTags(); Assert.Equal(6, pointTags.Count); Assert.Contains(new KeyValuePair <string, string>(Constants.ApplicationTagKey, "app1"), pointTags); Assert.Contains(new KeyValuePair <string, string>(Constants.ServiceTagKey, "service1"), pointTags); Assert.Contains(new KeyValuePair <string, string>(Constants.ClusterTagKey, "us-west"), pointTags); Assert.Contains(new KeyValuePair <string, string>(Constants.ShardTagKey, "db1"), pointTags); Assert.Contains(new KeyValuePair <string, string>("env", "production"), pointTags); Assert.Contains(new KeyValuePair <string, string>("location", "SF"), pointTags); }
private void InitMetricsHistogramsReporting( WavefrontSpanReporter wfSpanReporter, ApplicationTags applicationTags, TimeSpan reportFrequency, ILoggerFactory loggerFactory, out IMetricsRoot metricsRoot, out AppMetricsTaskScheduler metricsScheduler, out HeartbeaterService heartbeaterService, out WavefrontSdkMetricsRegistry sdkMetricsRegistry) { var tempMetricsRoot = new MetricsBuilder() .Configuration.Configure( options => { options.DefaultContextLabel = DerivedMetricPrefix; }) .Report.ToWavefront( options => { options.WavefrontSender = wfSpanReporter.WavefrontSender; options.Source = wfSpanReporter.Source; options.ApplicationTags = applicationTags; options.WavefrontHistogram.ReportMinuteDistribution = true; options.LoggerFactory = loggerFactory; }) .Build(); metricsRoot = tempMetricsRoot; metricsScheduler = new AppMetricsTaskScheduler( reportFrequency, async() => { await Task.WhenAll(tempMetricsRoot.ReportRunner.RunAllAsync()); }); metricsScheduler.Start(); heartbeaterService = new HeartbeaterService( wfSpanReporter.WavefrontSender, applicationTags, HeartbeaterComponents, wfSpanReporter.Source, loggerFactory); heartbeaterService.Start(); sdkMetricsRegistry = new WavefrontSdkMetricsRegistry .Builder(wfSpanReporter.WavefrontSender) .Prefix(Constants.SdkMetricPrefix + ".opentracing") .Source(wfSpanReporter.Source) .Tags(applicationTags.ToPointTags()) .LoggerFactory(loggerFactory) .Build(); wfSpanReporter.SetSdkMetricsRegistry(sdkMetricsRegistry); }
private WavefrontAspNetCoreReporter(IMetricsRoot metrics, IWavefrontSender wavefrontSender, ApplicationTags applicationTags, string source) { Metrics = metrics; WavefrontSender = wavefrontSender; ApplicationTags = applicationTags; Source = source; sdkMetricsRegistry = new WavefrontSdkMetricsRegistry .Builder(wavefrontSender) .Prefix(SdkMetricPrefix + ".aspnetcore") .Source(source) .Tags(applicationTags.ToPointTags()) .Build(); double sdkVersion = Utils.GetSemVer(Assembly.GetExecutingAssembly()); sdkMetricsRegistry.Gauge("version", () => sdkVersion); }