feat: integrate Pulumi event stream with OpenTelemetry for provisioning audit

Abierto
#813 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
go

Línea de trabajo

Comienza en pkg/manager, especialmente con los wrappers UpStack y DestroyStack, y lee los campos de contexto del manager para OtelAppCode y OtelAuthToken. Traza cómo se conectan los Pulumi EventStreams y, a continuación, define el flujo de eventos a logs de OTel y el ciclo de vida del exporter. Se considera terminado cuando los eventos de aprovisionamiento y desmantelamiento se exportan con los atributos indicados al configurar las credenciales, sin requerir nuevos flags.

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

Descripción

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
Lenguaje dominante
Go
Estrellas
25
Forks
41
Merge medio
5 d 3 h
PR fusionados (30 d)
16

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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

Todos los issues de redhat-developer/mapt

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.