feat: integrate Pulumi event stream with OpenTelemetry for provisioning audit

Aperta
#813 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
go

Direzione di ricerca

Inizia in pkg/manager, in particolare con i wrapper UpStack e DestroyStack, e leggi i campi del contesto del manager per OtelAppCode e OtelAuthToken. Traccia come vengono collegati i Pulumi EventStreams, quindi definisci il flusso dagli eventi ai log OTel e il ciclo di vita dell’exporter. Il lavoro è completato quando gli eventi di provisioning e decommissioning vengono esportati con gli attributi elencati quando le credenziali sono configurate, senza richiedere nuovi flag.

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

Descrizione

Summary

Currently, the otelcol-contrib filelog collector runs on the provisioned machine and ships runtime logs (syslog, auth, audit, gitlab-runner) to an OTLP endpoint. However, Pulumi provisioning and decommissioning events are not captured anywhere — meaning there is no audit trail for who created what, when, and whether it succeeded.

This issue tracks integrating the Pulumi Automation API event stream with OpenTelemetry so that stack-up and stack-destroy operations are also exported as OTel log records.

Motivation

For IBM Power and IBM Z targets running in an internal network, auditability of all actions is a hard requirement — not just what runs on the machine, but also the provisioning lifecycle itself. GitLab job logs are already being shipped via otelcol, but the provisioning events that precede and follow any job are currently dark.

Proposed approach

1. Hook into the Pulumi Automation API event stream

auto.Stack.Up() and auto.Stack.Destroy() accept auto.EventStreams(ch), which delivers typed events in real time:

  • engine.ResourcePreEvent — before a resource operation starts
  • engine.ResourceOutputsEvent — after a resource is created/updated
  • engine.DiagnosticEvent — log messages from providers/programs
  • engine.SummaryEvent — final outcome (succeeded/failed, duration, resource change counts)
  • engine.CancelEvent — cancellation
2. Convert events to OTel log records

Consume the channel in a goroutine inside pkg/manager (where UpStack/DestroyStack live). Convert each relevant event to an OTel log record using the Go OTel SDK and export directly to the configured --otel-endpoint.

Relevant resource attributes (matching what the filelog collector already attaches):

  • appcode — from --otel-app-code
  • com.redhat.otel.auth_token — from --otel-auth-token
  • project-name — from --project-name
  • operation — up or destroy
  • stack — Pulumi stack name
3. Dependencies

Add to the mapt binary:

  • go.opentelemetry.io/otel
  • go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
  • go.opentelemetry.io/otel/sdk/log

The --otel-* flags are already first-class CLI params on all targets that support otelcol, so no new flags are needed.

4. Integration point

The event consumer would be enabled only when OtelAppCode and OtelAuthToken are set in the mapt context (pkg/manager/context). The manager's UpStack/DestroyStack wrappers are the right place to attach it, keeping the concern isolated from individual provider implementations.

Tradeoffs

This approach Current otelcol on machine
Captures provisioning events ✅ ❌ (machine doesn't exist yet)
Captures runtime logs ❌ ✅
Requires otelcol on target No Yes
OTel SDK in mapt binary Yes No
Needs new flags No No

The two approaches are complementary and can coexist.

Related

  • PR adding GitLab runner + otelcol support for IBM Power and IBM Z: #812
Lingua principale
Go
Stelle
25
Fork
41
Merge medio
5g 3h
PR unite (30g)
16

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 redhat-developer/mapt

Tutte le issue di redhat-developer/mapt

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.