Skip to content

Wire resource attributes into Beholder ChipIngress emitters#2216

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

Wire resource attributes into Beholder ChipIngress emitters#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

Wire node resource attributes from beholder.Config.ResourceAttributes into the ChipIngress batch and sync emitters via CloudEvent extensions, so they reach the cre topic as ce_<sanitized> Kafka headers.

Changes

  • pkg/beholder/batch_emitter_service.go: store resource attributes and stamp them on each emitted event via chipingress.WithResourceAttributeExtensions.
  • pkg/beholder/chip_ingress_emitter.go: same for the sync emitter.
  • pkg/beholder/client.go: pass resource attributes into the ChipIngress client header provider.
  • pkg/beholder/resource_attributes.go: add resourceAttributesToStringMap helper.
  • Root go.mod: bump pkg/chipingress to the resource-attributes branch (Add resource attribute support to ChipIngress client #2267).

Related PRs

Test plan

  • go test ./pkg/beholder/...

Notes

  • The previous Co-authored-by: Cursor attribution has been removed from the commit history.
  • gRPC metadata → Kafka header forwarding is unconfirmed on the chip-ingress server side; the CE-extension path guarantees ce_<name> headers immediately.
  • pkg/durableemitter remains out of scope.

@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>
@pkcll
pkcll force-pushed the chip-ingress-resource-attributes branch 2 times, most recently 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>
@pkcll
pkcll force-pushed the chip-ingress-resource-attributes branch from 1f79a15 to e1e0648 Compare July 20, 2026 23:48
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 20, 2026
@pkcll
pkcll force-pushed the chip-ingress-resource-attributes branch 3 times, most recently from f5eda78 to 0a22a31 Compare July 21, 2026 05:25
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 21, 2026
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 21, 2026
@pkcll

pkcll commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Split into two PRs:

@pkcll pkcll closed this Jul 21, 2026
@pkcll pkcll reopened this Jul 21, 2026
pkcll added 2 commits July 21, 2026 02:37
Propagate node resource attributes from beholder.Config.ResourceAttributes
to the cre topic via ChipIngress CloudEvent extensions. Depends on the new
chipingress API introduced in #2267.
Root module must pin the submodule commit from #2267 that contains the new
chipingress API.
Copilot AI review requested due to automatic review settings July 21, 2026 06:38
@pkcll
pkcll force-pushed the chip-ingress-resource-attributes branch from 327f9ca to fccea7a Compare July 21, 2026 06:38
@pkcll pkcll changed the title Add resource attribute support to ChipIngress client Wire resource attributes into Beholder ChipIngress emitters Jul 21, 2026
pkcll added a commit to smartcontractkit/chainlink that referenced this pull request Jul 21, 2026

Copilot AI left a comment

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.

Pull request overview

Wires beholder.Config.ResourceAttributes into ChipIngress emitters so node resource attributes propagate to the cre topic (via CloudEvent extensions, and as gRPC metadata headers on the client).

Changes:

  • Add resourceAttributesToStringMap helper to canonicalize OTel resource attributes into map[string]string.
  • Stamp resource attributes onto ChipIngress events for both sync and batch emitters via chipingress.WithResourceAttributeExtensions.
  • Pass resource attributes into the ChipIngress client as a static header provider (sanitized for gRPC metadata), and bump pkg/chipingress to the needed pseudo-version.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/beholder/resource_attributes.go Adds helper to convert OTel resource attributes to string map.
pkg/beholder/resource_attributes_test.go Tests conversion/encoding behavior for several attribute types.
pkg/beholder/client.go Plumbs resource attributes into ChipIngress client headers and emitter construction.
pkg/beholder/chip_ingress_emitter.go Adds emitter support for stamping resource attributes as CE extensions.
pkg/beholder/chip_ingress_emitter_test.go Verifies CE extension stamping + backward-compat behavior when unset.
pkg/beholder/batch_emitter_service.go Stores resource attributes and stamps them on each batched event.
pkg/beholder/batch_emitter_service_test.go Adds coverage asserting resource attributes appear in emitted batches.
go.mod Bumps github.com/smartcontractkit/chainlink-common/pkg/chipingress version.
go.sum Updates sums for the bumped pkg/chipingress dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +61 to +64
var resourceAttrs *resourceAttrExtensions
if len(attrs) > 0 {
resourceAttrs = &resourceAttrExtensions{attrs: attrs}
}
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.

4 participants