Skip to content

Add resource attribute support to ChipIngress client#2216

Draft
pkcll wants to merge 2 commits into
mainfrom
chip-ingress-resource-attributes
Draft

Add resource attribute support to ChipIngress client#2216
pkcll wants to merge 2 commits into
mainfrom
chip-ingress-resource-attributes

Conversation

@pkcll

@pkcll pkcll commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds resource-attribute propagation from beholder.Config.ResourceAttributes to the ChipIngress cre topic via two mechanisms: (1) gRPC metadata headers (chipingress.WithHeaderProvider/NewStaticHeaderProvider), with sanitized keys per grpc-go validation; (2) CloudEvent extensions (chipingress.WithResourceAttributeExtensions) with keys sanitized to ^[a-z0-9]+$ per the CloudEvents spec, surfacing as ce_<name> Kafka headers.
  • Wires both the non-batch ChipIngressEmitter and ChipIngressBatchEmitterService to stamp resource attributes on every emitted event.
  • Bumps pkg/chipingress pseudo-version in root go.mod (no local replace directive).

Related PR

Known gaps / follow-ups

  • gRPC-metadata → Kafka-header forwarding is unconfirmed server-side. The chip-ingress server's baseKafkaHeaders logic does not appear to forward arbitrary incoming gRPC metadata onto Kafka headers today. The CE-extension mechanism guarantees headers immediately; the gRPC-metadata mechanism is shipped for observability now, with full parity once/if a chip-ingress server-side change forwards it. A follow-up ticket against chip-ingress should track that.
  • pkg/durableemitter is out of scope. It has its own NewEvent call site and config, and wiring it up would also require chainlink core changes (application.go, shell.go, plugins/loop_registry.go). Events emitted via durableemitter.GlobalEmit (workflows, capabilities) will not yet carry resource attributes on the cre topic.

Test plan

  • go test ./pkg/chipingress/... and go test ./pkg/beholder/... pass
  • New unit tests: SanitizeExtensionName, WithResourceAttributeExtensions (sanitization, reserved-name skip, deterministic dedup), NewStaticHeaderProvider, resourceAttributesToStringMap, and emitter-level tests asserting ce_<sanitized> extensions land on published/batched events
  • Manual verification against a live chip-ingress endpoint

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

✅ API Diff Results - github.com/smartcontractkit/chainlink-common/pkg/chipingress

✅ Compatible Changes (7)

./ (7)
  • EventOpt — ➕ Added

  • NewEventWithOpts — ➕ Added

  • NewStaticHeaderProvider — ➕ Added

  • SanitizeExtensionName — ➕ Added

  • SanitizeMetadataHeaders — ➕ Added

  • SanitizeMetadataValue — ➕ Added

  • WithResourceAttributeExtensions — ➕ Added


📄 View full apidiff report

@pkcll pkcll force-pushed the chip-ingress-resource-attributes branch from e6eabcc to fdb6dee Compare July 2, 2026 03:48
@pkcll pkcll requested a review from patrickhuie19 July 2, 2026 05:05
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

✅ API Diff Results - github.com/smartcontractkit/chainlink-common

✅ Compatible Changes (1)

pkg/beholder.ChipIngressEmitterConfig (1)
  • NewWithResourceAttributes — ➕ Added

📄 View full apidiff report

Comment thread go.mod Outdated
gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace github.com/smartcontractkit/chainlink-common/pkg/chipingress => ./pkg/chipingress

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way to avoid the local replace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, will clean this up.

patrickhuie19
patrickhuie19 previously approved these changes Jul 10, 2026
@pkcll pkcll force-pushed the chip-ingress-resource-attributes branch 5 times, most recently from aa6b73c to d6a531b Compare July 11, 2026 01:32
@engnke

engnke commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

overall approach lgtm. Adding the CloudEvent extensions as the guaranteed propagation path makes sense, and we're keeping the gRPC header route for observability is reasonable

@pkcll pkcll force-pushed the chip-ingress-resource-attributes branch 2 times, most recently from 2a6fa46 to 3ebb388 Compare July 13, 2026 21:12
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 13, 2026
Pick up chip-ingress resource attribute propagation from
smartcontractkit/chainlink-common#2216.

Co-authored-by: Cursor <cursoragent@cursor.com>
Propagate node resource attributes from beholder.Config.ResourceAttributes
to the cre topic via gRPC metadata headers and sanitized CloudEvent
extensions, matching legacy beholder__platform__messages identification.
@pkcll pkcll force-pushed the chip-ingress-resource-attributes branch from 3ebb388 to e7e82a2 Compare July 13, 2026 21:14
Root module must pin the submodule commit that contains the new
chipingress API; required after removing the local replace directive.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkcll pkcll force-pushed the chip-ingress-resource-attributes branch from e7e82a2 to 1f79a15 Compare July 13, 2026 21:14
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 13, 2026
Pick up chip-ingress resource attribute propagation from
smartcontractkit/chainlink-common#2216.

Co-authored-by: Cursor <cursoragent@cursor.com>
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 13, 2026
Pick up chip-ingress resource attribute propagation from
smartcontractkit/chainlink-common#2216.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants