public void MetricsAlreadyAdded() { Sensor sensor = new Sensor("sensor", "description", MetricsRecordingLevel.INFO); var metricStatName = MetricName.NameAndGroup("metric-stat-1", "METRIC-GROUP"); var metricImmutName = MetricName.NameAndGroup("metric-immu-1", "METRIC-GROUP"); var metricProName = MetricName.NameAndGroup("metric-pro-1", "METRIC-GROUP"); sensor.AddStatMetric(metricStatName, new Avg()); sensor.AddImmutableMetric(metricImmutName, 1); sensor.AddProviderMetric(metricProName, () => "coucou"); Assert.IsFalse(sensor.AddStatMetric(metricStatName, new Avg())); Assert.IsFalse(sensor.AddImmutableMetric(metricImmutName, 1)); Assert.IsFalse(sensor.AddProviderMetric(metricProName, () => "coucou")); }
public static Sensor CreateStartThreadSensor(string threadId, long startTime, StreamMetricsRegistry metricsRegistry) { Sensor sensor = metricsRegistry.ThreadLevelSensor( threadId, THREAD_START_TIME, THREAD_START_TIME_DESCRIPTION, MetricsRecordingLevel.INFO); var metricName = new MetricName(THREAD_START_TIME, StreamMetricsRegistry.THREAD_LEVEL_GROUP, THREAD_START_TIME_DESCRIPTION, metricsRegistry.ThreadLevelTags(threadId)); sensor.AddImmutableMetric(metricName, startTime); return(sensor); }