Repository: open-telemetry/opentelemetry-java
File: exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java (Java)

Code before:
      Attributes attributes,
      String... additionalAttributes) {

    List<AttributeKey<?>> allowedAttributeKeys =
        allowedResourceAttributesFilter != null
            ? filterAllowedResourceAttributeKeys(resource)
            : Collections.emptyList();

    Map<String, String> labelNameToValue = new HashMap<>();
    attributes.forEach(
        (key, value) ->
            labelNameToValue.put(
                sanitizeLabelName(key.getKey()), toLabelValue(key.getType(), value)));

    for (int i = 0; i < additionalAttributes.length; i += 2) {
      labelNameToValue.putIfAbsent(
          requireNonNull(additionalAttributes[i]), additionalAttributes[i + 1]);
    }

    if (otelScopeEnabled && scope != null) {
      labelNameToValue.putIfAbsent(OTEL_SCOPE_NAME, scope.getName());
      if (scope.getVersion() != null) {
        labelNameToValue.putIfAbsent(OTEL_SCOPE_VERSION, scope.getVersion());
      }
      String schemaUrl = scope.getSchemaUrl();
      labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl == null ? "" : schemaUrl);
      scope
          .getAttributes()
          .forEach(
              (key, value) ->
                  labelNameToValue.putIfAbsent(
                      OTEL_SCOPE_ATTRIBUTE_PREFIX + key.getKey(), value.toString()));
    }

    if (resource != null) {
      Attributes resourceAttributes = resource.getAttributes();
      for (AttributeKey attributeKey : allowedAttributeKeys) {
        Object attributeValue = resourceAttributes.get(attributeKey);
        if (attributeValue != null) {
          labelNameToValue.putIfAbsent(
              sanitizeLabelName(attributeKey.getKey()), attributeValue.toString());
        }
      }
    }

    String[] names = new String[labelNameToValue.size()];
    String[] values = new String[labelNameToValue.size()];
    int[] pos = new int[] {0};
    labelNameToValue.forEach(
        (name, value) -> {
          names[pos[0]] = name;

Review comment (suggestion):
Why not:
```suggestion
      if (schemaUrl != null) {
        labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl);
      }
```

Code after:
      Attributes attributes,
      String... additionalAttributes) {

    List<AttributeKey<?>> allowedAttributeKeys =
        allowedResourceAttributesFilter != null
            ? filterAllowedResourceAttributeKeys(resource)
            : Collections.emptyList();

    Map<String, String> labelNameToValue = new HashMap<>();
    attributes.forEach(
        (key, value) ->
            labelNameToValue.put(
                sanitizeLabelName(key.getKey()), toLabelValue(key.getType(), value)));

    for (int i = 0; i < additionalAttributes.length; i += 2) {
      labelNameToValue.putIfAbsent(
          requireNonNull(additionalAttributes[i]), additionalAttributes[i + 1]);
    }

    if (otelScopeEnabled && scope != null) {
      labelNameToValue.putIfAbsent(OTEL_SCOPE_NAME, scope.getName());
      if (scope.getVersion() != null) {
        labelNameToValue.putIfAbsent(OTEL_SCOPE_VERSION, scope.getVersion());
      }
      String schemaUrl = scope.getSchemaUrl();
      if (schemaUrl != null) {
        labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl);
      }
      scope
          .getAttributes()
          .forEach(
              (key, value) ->
                  labelNameToValue.putIfAbsent(
                      OTEL_SCOPE_ATTRIBUTE_PREFIX + key.getKey(), value.toString()));
    }

    if (resource != null) {
      Attributes resourceAttributes = resource.getAttributes();
      for (AttributeKey attributeKey : allowedAttributeKeys) {
        Object attributeValue = resourceAttributes.get(attributeKey);
        if (attributeValue != null) {
          labelNameToValue.putIfAbsent(
              sanitizeLabelName(attributeKey.getKey()), attributeValue.toString());
        }
      }
    }

    String[] names = new String[labelNameToValue.size()];
    String[] values = new String[labelNameToValue.size()];
    int[] pos = new int[] {0};
    labelNameToValue.forEach(