-
Notifications
You must be signed in to change notification settings - Fork 498
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
🌱 Monitoring: use opentelemetry for cron metrics #3503
Conversation
Signed-off-by: Raghav Kaul <[email protected]>
Signed-off-by: Raghav Kaul <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3503 +/- ##
===========================================
- Coverage 74.30% 59.36% -14.95%
===========================================
Files 187 175 -12
Lines 13378 12556 -822
===========================================
- Hits 9941 7454 -2487
- Misses 2878 4653 +1775
+ Partials 559 449 -110 |
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.
Left some partial thoughts since this is still a draft. I'm unfamiliar with the migration, so trying to get some details there.
metric.WithDescription("Measures the retry delay when dealing with secondary rate limits"), | ||
metric.WithUnit("s")) | ||
if err != nil { | ||
return |
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 think there's some unintentional shadowing here since you use c, err :=
above
// // GithubTokens tracks the usage/remaining stats per token per resource-type. | ||
// | ||
// GithubTokens = view.View{ | ||
// Name: "GithubTokens", | ||
// Description: "Token usage/remaining stats for Github API tokens", | ||
// Measure: RemainingTokens, | ||
// TagKeys: []tag.Key{TokenIndex, ResourceType}, | ||
// Aggregation: view.LastValue(), | ||
// } |
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.
this comment should probably be removed?
if err != nil { | ||
l.Warn(&LogMessage{Text: fmt.Sprintf("tag.New: %v", err)}) | ||
} | ||
|
||
ctx, err = tag.New(ctx, tag.Upsert(stats.RepoHost, r.CheckRequest.Repo.Host())) | ||
ctx = context.WithValue(ctx, stats.RepoHost, r.CheckRequest.Repo.Host()) |
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.
does it make a difference when you pass the value as an attribute, vs in the context? You do both in this PR.
Skimming one migration page, I thought otel didnt support context based attributes?
defer func() { | ||
if err := meterProvider.Shutdown(context.Background()); err != nil { | ||
fmt.Printf("couldn't shutdown meterProvider: %v\n", err) | ||
} | ||
}() |
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.
wouldn't this close the meter provider as soon as the function returns?
I think the Go idiom you're looking forward is returning a cancel/close/cleanup function, and then the caller can call/defer that when appropriate.
"contrib.go.opencensus.io/exporter/stackdriver" | ||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource/gcp" | ||
"go.opencensus.io/stats/view" | ||
mexporter "github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric" |
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.
would gcpexporter
provide more context?
ProjectID: projectID, | ||
MetricPrefix: prefix, | ||
MonitoredResource: gcp.Autodetect(), |
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.
Is this information being lost in the new implementation?
exporter, err := config.GetMetricExporter() | ||
if err != nil { | ||
return nil, fmt.Errorf("error during GetMetricExporter: %w", err) | ||
} | ||
|
||
fmt.Printf("Using %s exporter for metrics\n", exporter) |
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.
leftover print statement?
ctx, err := tag.New(ctx, tag.Upsert(stats.CheckName, r.CheckName)) | ||
err := stats.InitMetrics() | ||
if err != nil { | ||
panic(err) |
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.
is this something that should be setup in an init
?
Stale pull request message |
What kind of change does this PR introduce?
Use opentelemetry instead of opencensus