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

Declarative config fails SDK creation when a resource attribute value is null

Cerrado Apto para principiantes
#8,884 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Ya se ha fusionado un pull request relacionado.

  • #8889 de @thswlsqls — fusionado

Evaluación

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

Línea de trabajo

Comienza con AttributeListFactory.addToBuilder() y compara su manejo de null con OtlpDeclarativeConfigUtil, que ya omite los valores null. Inspecciona DeclarativeConfigurationParseTest para conocer el comportamiento de null en YAML y, a continuación, añade cobertura que demuestre que se ignora un atributo de recurso null y que el SDK se inicia correctamente.

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

Descripción

Describe the bug
A resource.attributes entry whose value is null makes declarative config throw DeclarativeConfigException: attribute value is required but is null, and the SDK fails to start.

Steps to reproduce
Add this to a config file and leave SERVICE_VERSION unset:

resource:
  attributes:
    - name: service.version
      value: ${SERVICE_VERSION}

An unquoted, undefined variable is substituted as YAML null (asserted by DeclarativeConfigurationParseTest). Writing value: null has the same effect.

What did you expect to see?
The entry is ignored and the SDK starts. The configuration schema says nullBehavior: the entry is ignored for AttributeNameValue.value (added in open-telemetry/opentelemetry-configuration#617), and the generated AttributeNameValueModel Javadoc in this repo says "Property must be present, but if null the entry is ignored."

What did you see instead?
AttributeListFactory.addToBuilder() (line 43) calls FileConfigUtil.requireNonNull on the value and throws. OTLP headers, which have the same schema rule, already skip null values (OtlpDeclarativeConfigUtil).

What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-extension-declarative-config
Version: main @ 7f423cbb1
How did you reference these artifacts? N/A (built from source)

Environment
Compiler: Temurin 21
OS: N/A

Additional context
N/A

Lenguaje dominante
Java
Estrellas
2.5k
Forks
1k
Merge medio
2 d 22 h
PR fusionados (30 d)
59

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 open-telemetry/opentelemetry-java

Todos los issues de open-telemetry/opentelemetry-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.