Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

prometheus-metrics-core makes io.prometheus.metrics.tracer.initializer a mandatory OSGi import although the code supports its absence

Cerrado Apto para principiantes
#2,516 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #2528 de @kalayciburak — fusionado

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java
Área
build-system

Línea de trabajo

Empieza por las instrucciones del maven-bundle-plugin para prometheus-metrics-core e inspecciona el manifiesto OSGi generado en busca de la importación de io.prometheus.metrics.tracer.initializer. Haz que la importación sea opcional, luego ejecuta las pruebas OSGi o micrometer-osgi-test-tests y verifica que el bundle se resuelve sin prometheus-metrics-tracer-initializer.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

prometheus-metrics-core 1.9.0 ships Import-Package: io.prometheus.metrics.tracer.initializer;version="[1.9,2)" with no resolution:=optional, so an OSGi deployment that leaves out prometheus-metrics-tracer-initializer cannot resolve the bundle.

The code is written for that artifact to be absent. ExemplarSampler.sampleTraceContextLabels() calls SpanContextSupplier through its fully qualified name on purpose, and the comment says why:

// Using the qualified name so that Micrometer can exclude the dependency on
// prometheus-metrics-tracer-initializer
// as they provide their own implementation of SpanContextSupplier.
// If we had an import statement for SpanContextSupplier the dependency would be needed in any case.

The block that follows is guarded with catch (NoClassDefFoundError ignored).

Micrometer does exactly what that comment describes: micrometer-registry-prometheus excludes the artifact from prometheus-metrics-core. On the Maven side it works. In OSGi it does not resolve:

⇒ Bundle: micrometer-osgi-test-tests cannot be resolved
    ⇒ because Import-Package requirement for: io.micrometer.prometheusmetrics could not be provided
        ⇒ because Import-Package requirement for: io.prometheus.metrics.core.exemplars; version=[1.9.0,2.0.0)
            ⇒ because Import-Package requirement for: io.prometheus.metrics.tracer.initializer; version=[1.9.0,2.0.0)

Dropping prometheus-metrics-tracer-initializer onto the runtime makes it resolve and the tests pass, so that import is the only thing missing.

Marking it optional in the maven-bundle-plugin instructions for prometheus-metrics-core would line the manifest up with what the code already allows, the same way _exportcontents was added to prometheus-metrics-exposition-formats for #2395.

Lenguaje dominante
Java
Estrellas
2.3k
Forks
832
Merge medio
1 d 9 h
PR fusionados (30 d)
73

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de prometheus/client_java

Todos los issues de prometheus/client_java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.