feat: add OpenTelemetry tracing support for CI/CD observability

Fechada
#364 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
go

Direção de pesquisa

Comece lendo cmd/root.go e o código dos conectores em pkg/connectors; depois, revise o ponto de entrada proposto pkg/observability/tracing.go e os requisitos de instrumentação HTTP do OTel. O trabalho estará concluído quando o tracing for opt-in por meio de OTEL_EXPORTER_OTLP_ENDPOINT, as operações listadas de test, poll e upload emitirem spans, as requisições de saída carregarem cabeçalhos traceparent e o comportamento existente permanecer inalterado quando a variável estiver ausente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Reason/Context

When microcks test fails in a CI/CD pipeline, platform engineers have no way to correlate the CLI execution with what happened on the Microcks server or the API under test. The CLI is a complete black box — no trace context, no span data, no correlation IDs in logs.

Modern platform teams run observability stacks (Grafana/Tempo, Jaeger, Datadog) and expect every tool in their pipeline to emit trace context. Without it, debugging a failed API test requires manually cross-referencing timestamps across multiple systems.

Since Microcks is a CNCF Sandbox project, adding OTel tracing aligns directly with CNCF's observability principles and makes Microcks significantly more attractive to enterprise platform teams who already run OTel collectors in their infrastructure.

Description

Add opt-in OpenTelemetry (OTel) distributed tracing to microcks-cli so engineers can trace a full test lifecycle from CLI invocation → Microcks server → target API endpoint.

Activation: via standard OTel environment variable — OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317

  • If the env var is absent → zero overhead, zero behavior change, no new output
  • If set → CLI initializes an OTLP exporter and emits spans for key operations

Spans emitted:

  • microcks.test.create — when a test result is created on the server
  • microcks.test.poll — each polling iteration waiting for test completion
  • microcks.import.upload — when an artifact is uploaded

W3C Trace Context: injects traceparent headers into all outgoing HTTP requests so the Microcks server can participate in the same trace.

This is a non-breaking change. Fully opt-in via environment variable. Existing users see zero difference unless they explicitly set the OTLP endpoint.

Implementation ideas

New package pkg/observability/tracing.go — initializes the OTel provider and returns a shutdown function:

func InitTracer(serviceName string) (func(context.Context) error, error) {
    // reads OTEL_EXPORTER_OTLP_ENDPOINT from env
    // returns no-op tracer if unset
}

Wire into `cmd/root.go` PersistentPreRun — initialize once, shutdown in PersistentPostRun.

Wrap the HTTP client in `pkg/connectors/` using `otelhttp.NewTransport`:

Dependencies to add:
- go.opentelemetry.io/otel (CNCF graduated project)
- go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp

Fully opt-in — no Kubernetes or external collector required. Works with any OTLP-compatible backend (Jaeger, Tempo, Datadog). Happy to implement if the approach looks good.
Linguagem predominante
Go
Estrelas
59
Forks
75
Merge médio
4d 5h
PRs com merge (30d)
15

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de microcks/microcks-cli

Todas as issues de microcks/microcks-cli

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.