private static Sensor ThroughputAndLatencySensor(TaskId taskId,
                                                         string storeType,
                                                         string storeName,
                                                         string metricName,
                                                         string metricDescription,
                                                         string descriptionOfRate,
                                                         string descriptionOfAvg,
                                                         string descriptionOfMax,
                                                         MetricsRecordingLevel recordingLevel,
                                                         StreamMetricsRegistry streamsMetrics)
        {
            Sensor sensor;
            string latencyMetricName          = metricName + StreamMetricsRegistry.LATENCY_SUFFIX;
            IDictionary <string, string> tags =
                streamsMetrics.StoreLevelTags(GetThreadId(), taskId.ToString(), storeName, storeType);

            sensor = streamsMetrics.StoreLevelSensor(GetThreadId(), taskId, storeName, metricName, metricDescription, recordingLevel);
            SensorHelper.AddInvocationRateToSensor(sensor, StreamMetricsRegistry.STATE_STORE_LEVEL_GROUP, tags, metricName,
                                                   descriptionOfRate);

            SensorHelper.AddAvgAndMaxToSensor(
                sensor,
                StreamMetricsRegistry.STATE_STORE_LEVEL_GROUP,
                tags,
                latencyMetricName,
                descriptionOfAvg,
                descriptionOfMax
                );
            return(sensor);
        }
        private static Sensor SizeOrCountSensor(TaskId taskId,
                                                string storeType,
                                                string storeName,
                                                string metricName,
                                                string metricDescription,
                                                string descriptionOfAvg,
                                                string descriptionOfMax,
                                                MetricsRecordingLevel recordingLevel,
                                                StreamMetricsRegistry streamsMetrics)
        {
            Sensor sensor = streamsMetrics.StoreLevelSensor(
                GetThreadId(),
                taskId,
                storeName,
                metricName,
                metricDescription,
                recordingLevel);
            string group;
            IDictionary <string, string> tags;

            group = StreamMetricsRegistry.STATE_STORE_LEVEL_GROUP;
            tags  = streamsMetrics.StoreLevelTags(GetThreadId(), taskId.ToString(), storeName, storeType);

            SensorHelper.AddAvgAndMaxToSensor(sensor, group, tags, metricName, descriptionOfAvg, descriptionOfMax);

            return(sensor);
        }
        private static Sensor AvgAndMaxSensor(string threadId,
                                              TaskId taskId,
                                              string metricName,
                                              string metricDescription,
                                              string descriptionOfAvg,
                                              string descriptionOfMax,
                                              MetricsRecordingLevel recordingLevel,
                                              StreamMetricsRegistry streamsMetrics)
        {
            Sensor sensor =
                streamsMetrics.TaskLevelSensor(threadId, taskId, metricName, metricDescription, recordingLevel);
            var tags = streamsMetrics.TaskLevelTags(threadId, taskId.ToString());

            SensorHelper.AddAvgAndMaxToSensor(
                sensor,
                StreamMetricsRegistry.TASK_LEVEL_GROUP,
                tags,
                metricName,
                descriptionOfAvg,
                descriptionOfMax
                );

            return(sensor);
        }