feat: integrate Pulumi event stream with OpenTelemetry for provisioning audit

未关闭
#813 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
go

调研方向

从 pkg/manager 开始,重点查看 UpStack 和 DestroyStack wrapper,并读取 manager context 中用于 OtelAppCode 和 OtelAuthToken 的字段。跟踪 Pulumi EventStreams 的连接方式,然后定义 event 到 OTel log 的流程以及 exporter 生命周期。当配置了 credentials 后,provisioning 和 decommissioning event 能够带有所列属性被导出,且不需要新增 flags 时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Go
星标
25
派生
41
平均合并
5 天 3 小时
30 天内合并 PR
16

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

redhat-developer/mapt 的其他 Issue

查看 redhat-developer/mapt 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。