Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa Adatta ai principianti
#8,884 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Una pull request collegata è già stata integrata.

  • #8889 di @thswlsqls — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

Inizia con AttributeListFactory.addToBuilder() e confronta la sua gestione di null con OtlpDeclarativeConfigUtil, che ignora già i valori null. Esamina DeclarativeConfigurationParseTest per il comportamento di null in YAML, quindi aggiungi test che mostrino che un attributo della risorsa null viene ignorato e che l’SDK si avvia correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Java
Stelle
2.5k
Fork
1k
Merge medio
3g 6h
PR unite (30g)
67

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-telemetry/opentelemetry-java

Tutte le issue di open-telemetry/opentelemetry-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.