Propagate the request correlation id to downstream sinks
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 72/100
Direção de pesquisa
Leia src/utils/observability.py primeiro para confirmar como os IDs de correlação são resolvidos e, em seguida, rastreie o caminho da chamada em HandlerTopic._write_to_all() até WriterKafka.write() e WriterEventBridge.write(). Implemente a propagação somente por meio de metadados de transporte (header do Kafka ou detail/TraceHeader do EventBridge) e preserve o comportamento quando não houver ID. Execute ou adicione testes unitários com e sem ID de correlação e verificações de integração para os metadados do sink; depois, atualize a seção "Logging & Correlation" do README para documentar o contrato.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Feature Description
Propagate the request correlation id to the downstream sinks, so consumers of the fan-out targets can join their processing logs to the EventGate request that produced the message:
- Kafka — add the id as a record header (e.g.
correlation_id) inWriterKafka.write(). Record headers keep the payload untouched, and consumers can read the header without schema changes. - EventBridge — include the id in the
put_eventsentry, either as a top-level field ofDetailor viaTraceHeader, inWriterEventBridge.write(). - Postgres — optional; would require a schema change (extra column), so likely out of scope for the first iteration.
Problem / Opportunity
Since #193 / PR #204, every EventGate request resolves a correlation id (X-Correlation-ID → X-Request-ID → API Gateway request id), logs it on every line and returns it in the X-Correlation-ID response header. The id currently stops at EventGate: once a message is fanned out, downstream consumers have no way to correlate their processing with the originating request.
Beneficiaries: teams consuming the Kafka topics and EventBridge events, and anyone debugging a cross-system flow end-to-end — one id would then trace a message from the caller, through EventGate's logs, into every sink's consumer logs.
Acceptance Criteria
- A message published to Kafka carries the request's correlation id as a record header; the message payload (value) is byte-for-byte unchanged.
- An event published to EventBridge carries the request's correlation id in its entry metadata (
TraceHeaderor a documentedDetailfield); the schema-validated payload is unchanged. - When no correlation id is resolved (empty id), no header/field is added and writes behave exactly as today.
- Existing topic schema validation and all existing consumers are unaffected — propagation uses transport metadata only, never the message body.
- Unit tests cover both writers with and without a bound correlation id; integration tests prove the header/field arrives in the sink.
- README "Logging & Correlation" documents the downstream propagation contract.
Proposed Solution
The writers do not currently receive the correlation id; it is bound in src/utils/observability.py. Two options:
- a small accessor (e.g.
current_correlation_id()) insrc/utils/observability.py, read by the writers, or - an explicit parameter threaded through
HandlerTopic._write_to_all()intoWriter.write().
The explicit parameter is more testable and keeps writers free of hidden state; the accessor avoids touching the Writer interface. Alternative considered and rejected: putting the id into the message body — breaks topic schema validation and changes consumer contracts.
The id is already validated against ^[A-Za-z0-9._:-]{1,128}$ before use, so it is safe to forward verbatim.
Dependencies / Related
- #193 (structured logging + correlation id)
- PR #204 (implementation; ADR
adr/001-observability/001-observability.md)
Additional Context
Follow-up proposed during the second-opinion review of PR #204 (item P7). Postgres propagation can be a separate issue if a schema change is ever justified.
- Linguagem predominante
- Python
- Estrelas
- 4
- Forks
- 0
- Merge médio
- 22h 3min
- PRs com merge (30d)
- 8
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de AbsaOSS/EventGate
-
refactoring type:tech-debt
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 64/100
-
Make Writes IdempotentAbertaenhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 32/100
Todas as issues de AbsaOSS/EventGate
Issues semelhantes
-
README.zh-CN/ja/es still hard-code 501 test counts after README.md went count-freeTalvez já em andamento @Aaqibhafeezkhan assumiu hoje. Abertabeginner documentation good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
BistaDinesh03/critique#164 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug IO
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
MrNeRF/LichtFeld-Studio#3824 ·
Mantenedores costumam responder em até 1 dia
-
bug confirmed issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
open-webui/open-webui#33200 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Lychee link check failedAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog checkTalvez já em andamento @ocelotl assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
open-telemetry/opentelemetry-python#5825 ·
Mantenedores costumam responder em até 2 dias