@@ -54,6 +54,15 @@ public final class FeatureToggle {
5454 */
5555 public static final String JSON_KEY_VALIDATION_ENABLED = "ditto.devops.feature.json-key-validation-enabled" ;
5656
57+ /**
58+ * System property name of the property defining whether when tracing is activated span metrics are also recorded
59+ * and exposed as Prometheus metrics. This is a built-in default of Kamon, Ditto's used tracing library, but can
60+ * be deactivated to reduce the amount of recorded metrics.
61+ *
62+ * @since 3.8.7
63+ */
64+ public static final String TRACING_SPAN_METRICS_ENABLED = "ditto.devops.feature.tracing-span-metrics-enabled" ;
65+
5766 /**
5867 * Resolves the system property {@value MERGE_THINGS_ENABLED}.
5968 */
@@ -79,6 +88,11 @@ public final class FeatureToggle {
7988 */
8089 private static final boolean IS_JSON_KEY_VALIDATION_ENABLED = resolveProperty (JSON_KEY_VALIDATION_ENABLED );
8190
91+ /**
92+ * Resolves the system property {@value TRACING_SPAN_METRICS_ENABLED}.
93+ */
94+ private static final boolean IS_TRACING_SPAN_METRICS_ENABLED = resolveProperty (TRACING_SPAN_METRICS_ENABLED );
95+
8296 private static boolean resolveProperty (final String propertyName ) {
8397 final String propertyValue = System .getProperty (propertyName , Boolean .TRUE .toString ());
8498 return !Boolean .FALSE .toString ().equalsIgnoreCase (propertyValue );
@@ -183,10 +197,21 @@ public static boolean isPreserveKnownMqttHeadersFeatureEnabled() {
183197 /**
184198 * Returns whether JSON key validation is enabled based on the system property {@value JSON_KEY_VALIDATION_ENABLED}.
185199 *
186- * @return whether JSON key validation is enabled based on the system property
200+ * @return whether JSON key validation is enabled.
187201 * @since 3.7.5
188202 */
189203 public static boolean isJsonKeyValidationEnabled () {
190204 return IS_JSON_KEY_VALIDATION_ENABLED ;
191205 }
206+
207+ /**
208+ * Returns whether tracing span metric reporting is enabled based on the system property
209+ * {@value TRACING_SPAN_METRICS_ENABLED}.
210+ *
211+ * @return whether tracing span metric reporting is enabled.
212+ * @since 3.8.7
213+ */
214+ public static boolean isTracingSpanMetricsEnabled () {
215+ return IS_TRACING_SPAN_METRICS_ENABLED ;
216+ }
192217}
0 commit comments