-
Notifications
You must be signed in to change notification settings - Fork 2k
adding resource manager for workflows #22845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
patrickhuie19
wants to merge
18
commits into
develop
Choose a base branch
from
feat/shared-2712
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,782
−165
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7bafc6b
adding resource manager for wf size
patrickhuie19 276ddee
bumping common and protos to remove local replace
patrickhuie19 937a244
updates from proto and plumbing config
patrickhuie19 8fd5251
adding numericTenantID + reducing naming complexity in protos
patrickhuie19 d288672
feat(metering): TOML-only gating, node_id logical name, syncer delta …
patrickhuie19 1898360
feat(metering): supply deterministic cross-node event_id from workflo…
patrickhuie19 58607d9
updates from chainlink-common changes
patrickhuie19 c662958
Merge branch 'develop' into feat/shared-2712
patrickhuie19 72b90d5
Merge branch 'develop' into feat/shared-2712
patrickhuie19 a500659
lint
patrickhuie19 cc1ab09
removing local replaces
patrickhuie19 1b333be
cleanup
patrickhuie19 3d48b1c
dependency bumps, refactoring, some correctness changes
patrickhuie19 af84741
Merge branch 'develop' into feat/shared-2712
patrickhuie19 9ca0e7f
Merge branch 'develop' into feat/shared-2712
patrickhuie19 54689c5
fixing tests
patrickhuie19 d17cd8b
cleaning up reconcile orphan behavior; adding paused state to workflo…
patrickhuie19 bfb6a4b
removing redundant WorkflowDONSubscriber; lint
patrickhuie19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package config | ||
|
|
||
| // Metering exposes durable resource-metering configuration: the emission | ||
| // toggles and the coarse deployment/node identity dimensions stamped on emitted | ||
| // MeterRecords and MeterSnapshots. These are passed via loop.EnvConfig to every LOOP | ||
| // plugin. | ||
| type Metering interface { | ||
| MeterRecordsEnabled() bool | ||
| MeterSnapshotsEnabled() bool | ||
| Product() string | ||
| Tenant() string | ||
| NumericTenantID() string | ||
| Environment() string | ||
| Zone() string | ||
| NodeID() string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,7 @@ type Core struct { | |
| Mercury Mercury `toml:",omitempty"` | ||
| Capabilities Capabilities `toml:",omitempty"` | ||
| Telemetry Telemetry `toml:",omitempty"` | ||
| Metering Metering `toml:",omitempty"` | ||
| Workflows Workflows `toml:",omitempty"` | ||
| CRE CreConfig `toml:",omitempty"` | ||
| Billing Billing `toml:",omitempty"` | ||
|
|
@@ -113,6 +114,7 @@ func (c *Core) SetFrom(f *Core) { | |
| c.JobDistributor.setFrom(&f.JobDistributor) | ||
| c.Tracing.setFrom(&f.Tracing) | ||
| c.Telemetry.setFrom(&f.Telemetry) | ||
| c.Metering.setFrom(&f.Metering) | ||
| c.CRE.setFrom(&f.CRE) | ||
| c.Billing.setFrom(&f.Billing) | ||
| c.BridgeStatusReporter.setFrom(&f.BridgeStatusReporter) | ||
|
|
@@ -3164,6 +3166,75 @@ func (b *Telemetry) ValidateConfig() (err error) { | |
| return err | ||
| } | ||
|
|
||
| // Metering configures durable resource metering emission and the coarse | ||
| // deployment/node identity dimensions stamped on emitted MeterRecords and | ||
| // MeterSnapshots. These are passed via loop.EnvConfig to every LOOP plugin. | ||
| type Metering struct { | ||
| // MeterRecordsEnabled enables durable MeterRecord emission for LOOP plugins. | ||
| MeterRecordsEnabled *bool | ||
| // MeterSnapshotsEnabled enables durable MeterSnapshot emission. Requires | ||
| // MeterRecordsEnabled to be true. | ||
| MeterSnapshotsEnabled *bool | ||
| // Product is the deployment product identity dimension, e.g. "cre". | ||
| Product *string | ||
| // Tenant is the human-readable tenant name, e.g. "mainline". | ||
| Tenant *string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this different from the cresettings |
||
| // NumericTenantID is the numbered tenant identifier as a string. | ||
| NumericTenantID *string | ||
| // Environment is the deployment environment dimension, e.g. "production". | ||
| Environment *string | ||
| // Zone is the deployment zone dimension, e.g. "wf-zone-a". | ||
| Zone *string | ||
| // NodeID is the node's logical name, e.g. "clp-cre-wf-zone-a-1" (NOT the CSA | ||
| // public key) | ||
| NodeID *string | ||
| } | ||
|
|
||
| func (b *Metering) setFrom(f *Metering) { | ||
| if v := f.MeterRecordsEnabled; v != nil { | ||
| b.MeterRecordsEnabled = v | ||
| } | ||
| if v := f.MeterSnapshotsEnabled; v != nil { | ||
| b.MeterSnapshotsEnabled = v | ||
| } | ||
| if v := f.Product; v != nil { | ||
| b.Product = v | ||
| } | ||
| if v := f.Tenant; v != nil { | ||
| b.Tenant = v | ||
| } | ||
| if v := f.NumericTenantID; v != nil { | ||
| b.NumericTenantID = v | ||
| } | ||
| if v := f.Environment; v != nil { | ||
| b.Environment = v | ||
| } | ||
| if v := f.Zone; v != nil { | ||
| b.Zone = v | ||
| } | ||
| if v := f.NodeID; v != nil { | ||
| b.NodeID = v | ||
| } | ||
| } | ||
|
|
||
| func (b *Metering) ValidateConfig() (err error) { | ||
| if b.MeterSnapshotsEnabled != nil && *b.MeterSnapshotsEnabled && (b.MeterRecordsEnabled == nil || !*b.MeterRecordsEnabled) { | ||
| err = errors.Join(err, configutils.ErrInvalid{ | ||
| Name: "MeterSnapshotsEnabled", | ||
| Value: true, | ||
| Msg: "requires MeterRecordsEnabled to be true", | ||
| }) | ||
| } | ||
| if b.MeterRecordsEnabled != nil && *b.MeterRecordsEnabled && (b.NodeID == nil || *b.NodeID == "") { | ||
| err = errors.Join(err, configutils.ErrInvalid{ | ||
| Name: "NodeID", | ||
| Value: "", | ||
| Msg: "must be non-empty when MeterRecordsEnabled is true (an empty NodeID collapses per-node snapshot dedup scope DON-wide)", | ||
| }) | ||
| } | ||
| return err | ||
| } | ||
|
|
||
| type PrometheusBridge struct { | ||
| Enabled *bool | ||
| Prefixes []string | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if just
Meteringis clear, especially alongsideTelemetry. What about something likeResourceMetering? Or would it make sense asCRE.Metering?