Skip to content

pkg/services/orgresolver: track pass/fail metrics#2099

Draft
jmank88 wants to merge 1 commit into
mainfrom
CRE-3887-org-resolver-metrics
Draft

pkg/services/orgresolver: track pass/fail metrics#2099
jmank88 wants to merge 1 commit into
mainfrom
CRE-3887-org-resolver-metrics

Conversation

@jmank88

@jmank88 jmank88 commented May 28, 2026

Copy link
Copy Markdown
Contributor

https://smartcontract-it.atlassian.net/browse/CRE-3887
Support passing a metric.Meter to the org resolver to report pass/fail metrics.

@github-actions

Copy link
Copy Markdown

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

✅ Compatible Changes (3)

pkg/services/orgresolver.(*Config) (1)
  • New — ➕ Added
pkg/services/orgresolver.Config (2)
  • Client — ➕ Added

  • Meter — ➕ Added


📄 View full apidiff report

resp, err := o.client.GetOrganizationFromWorkflowOwner(ctx, req)
if err != nil {
if o.failCount != nil {
o.failCount.Add(ctx, 1) //TODO owner attribute?

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.

Are owner attributes helpful? Or just noise with extra cardinality?

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.

good q, they are helpful. we generally pass a labeler around in the engine to have KV attributes we want. The potential problem is that we can't have high cardinality values, for instance WorkflowExecutionID. So to give clients the option, we could define a map on Config that is optional for clients creating an org resolver.

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.

But do we actually expect the information to be relevant? I wouldn't think problems at this level would be correlated with particular owners. (and even if they were, that would imply the requests are being received by the server, who should be reporting better information than we can as clients?)

return cfg.New(logger)
}

func (cfg *Config) New(logger log.Logger) (*orgResolver, error) {

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.

Why the indirection with exporting New over *Config vs just calling into the exported NewOrgResolverWithClient? The old pattern better supported testing

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.

I added a new field Meter metric.Meter. The XWithY suffix pattern doesn't scale. Why is testing more difficult?

if cfg.Meter != nil {
var err error
//TODO names
resolver.passCount, err = cfg.Meter.Int64Counter("foo.bar.TODO.pass")

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.

i think just the straight name here is fine, even without dot notations to give a path. i.e. "org_resolver_success" and "org_resolver_fail"

resp, err := o.client.GetOrganizationFromWorkflowOwner(ctx, req)
if err != nil {
if o.failCount != nil {
o.failCount.Add(ctx, 1) //TODO owner attribute?

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.

good q, they are helpful. we generally pass a labeler around in the engine to have KV attributes we want. The potential problem is that we can't have high cardinality values, for instance WorkflowExecutionID. So to give clients the option, we could define a map on Config that is optional for clients creating an org resolver.

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.

2 participants