File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ final class Otel2PrometheusConverter {
7575 private static final ThrottlingLogger THROTTLING_LOGGER = new ThrottlingLogger (LOGGER );
7676 private static final String OTEL_SCOPE_NAME = "otel_scope_name" ;
7777 private static final String OTEL_SCOPE_VERSION = "otel_scope_version" ;
78+ private static final String OTEL_SCOPE_SCHEMA_URL = "otel_scope_schema_url" ;
79+ private static final String OTEL_SCOPE_ATTRIBUTE_PREFIX = "otel_scope_" ;
7880 private static final long NANOS_PER_MILLISECOND = TimeUnit .MILLISECONDS .toNanos (1 );
7981 static final int MAX_CACHE_SIZE = 10 ;
8082
@@ -484,6 +486,16 @@ private Labels convertAttributes(
484486 if (scope .getVersion () != null ) {
485487 labelNameToValue .putIfAbsent (OTEL_SCOPE_VERSION , scope .getVersion ());
486488 }
489+ String schemaUrl = scope .getSchemaUrl ();
490+ if (schemaUrl != null ) {
491+ labelNameToValue .putIfAbsent (OTEL_SCOPE_SCHEMA_URL , schemaUrl );
492+ }
493+ scope
494+ .getAttributes ()
495+ .forEach (
496+ (key , value ) ->
497+ labelNameToValue .putIfAbsent (
498+ OTEL_SCOPE_ATTRIBUTE_PREFIX + key .getKey (), value .toString ()));
487499 }
488500
489501 if (resource != null ) {
You can’t perform that action at this time.
0 commit comments