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 @@ -77,6 +77,8 @@ final class Otel2PrometheusConverter {
7777 private static final ThrottlingLogger THROTTLING_LOGGER = new ThrottlingLogger (LOGGER );
7878 private static final String OTEL_SCOPE_NAME = "otel_scope_name" ;
7979 private static final String OTEL_SCOPE_VERSION = "otel_scope_version" ;
80+ private static final String OTEL_SCOPE_SCHEMA_URL = "otel_scope_schema_url" ;
81+ private static final String OTEL_SCOPE_ATTRIBUTE_PREFIX = "otel_scope_" ;
8082 private static final long NANOS_PER_MILLISECOND = TimeUnit .MILLISECONDS .toNanos (1 );
8183 static final int MAX_CACHE_SIZE = 10 ;
8284
@@ -488,6 +490,16 @@ private Labels convertAttributes(
488490 if (scope .getVersion () != null ) {
489491 labelNameToValue .putIfAbsent (OTEL_SCOPE_VERSION , scope .getVersion ());
490492 }
493+ String schemaUrl = scope .getSchemaUrl ();
494+ if (schemaUrl != null ) {
495+ labelNameToValue .putIfAbsent (OTEL_SCOPE_SCHEMA_URL , schemaUrl );
496+ }
497+ scope
498+ .getAttributes ()
499+ .forEach (
500+ (key , value ) ->
501+ labelNameToValue .putIfAbsent (
502+ OTEL_SCOPE_ATTRIBUTE_PREFIX + key .getKey (), value .toString ()));
491503 }
492504
493505 if (resource != null ) {
You can’t perform that action at this time.
0 commit comments