-
Notifications
You must be signed in to change notification settings - Fork 248
feat: add metrics for debuginfo #1704
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,7 @@ import ( | |||||||||
| "github.com/go-kit/log" | ||||||||||
| "github.com/go-kit/log/level" | ||||||||||
| "github.com/nanmu42/limitio" | ||||||||||
| "github.com/prometheus/client_golang/prometheus" | ||||||||||
| "github.com/thanos-io/objstore" | ||||||||||
| "github.com/thanos-io/objstore/client" | ||||||||||
| "go.opentelemetry.io/otel/attribute" | ||||||||||
|
|
@@ -79,28 +80,96 @@ type Store struct { | |||||||||
|
|
||||||||||
| metadata MetadataManager | ||||||||||
| debuginfodClient DebugInfodClient | ||||||||||
|
|
||||||||||
| validationAttemptsTotal prometheus.Counter | ||||||||||
| validationErrorsTotal prometheus.CounterVec | ||||||||||
| metadataUpdateDuration prometheus.Histogram | ||||||||||
| uploadDebugInfoAttemptsTotal prometheus.Counter | ||||||||||
| uploadDebugInfoErrorsTotal prometheus.CounterVec | ||||||||||
| uploadDebugInfoDuration prometheus.Histogram | ||||||||||
| existsCheckDuration prometheus.Histogram | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // NewStore returns a new debug info store. | ||||||||||
| func NewStore( | ||||||||||
| tracer trace.Tracer, | ||||||||||
| logger log.Logger, | ||||||||||
| reg prometheus.Registerer, | ||||||||||
| cacheDir string, | ||||||||||
| metadata MetadataManager, | ||||||||||
| bucket objstore.Bucket, | ||||||||||
| debuginfodClient DebugInfodClient, | ||||||||||
| ) (*Store, error) { | ||||||||||
| uploadDebugInfoAttemptsTotal := prometheus.NewCounter( | ||||||||||
| prometheus.CounterOpts{ | ||||||||||
| Name: "debuginfo_upload_attempts_total", | ||||||||||
| Help: "Total attempts to upload debuginfo.", | ||||||||||
| }, | ||||||||||
| ) | ||||||||||
| uploadDebugInfoErrorsTotal := prometheus.NewCounterVec( | ||||||||||
| prometheus.CounterOpts{ | ||||||||||
| Name: "debuginfo_upload_errors_total", | ||||||||||
| Help: "Total number of errors in uploading debuginfo.", | ||||||||||
| }, | ||||||||||
| []string{"reason"}, | ||||||||||
| ) | ||||||||||
| uploadDebugInfoDuration := prometheus.NewHistogram( | ||||||||||
| prometheus.HistogramOpts{ | ||||||||||
| Name: "debuginfo_upload_duration_seconds", | ||||||||||
| Help: "How long it took in seconds to upload debuginfo.", | ||||||||||
| Buckets: []float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}, | ||||||||||
| }, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| existsCheckDuration := prometheus.NewHistogram( | ||||||||||
| prometheus.HistogramOpts{ | ||||||||||
| Name: "debuginfo_exists_check_duration_seconds", | ||||||||||
| Help: "How long it took in seconds to check existing debuginfo.", | ||||||||||
| Buckets: []float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}, | ||||||||||
| }, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| metadataUpdateDuration := prometheus.NewHistogram( | ||||||||||
| prometheus.HistogramOpts{ | ||||||||||
| Name: "debuginfo_metadata_update_duration_seconds", | ||||||||||
| Help: "How long it took in seconds to finish updating metadata.", | ||||||||||
| Buckets: []float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}, | ||||||||||
| }, | ||||||||||
| ) | ||||||||||
| validationAttemptsTotal := prometheus.NewCounter( | ||||||||||
| prometheus.CounterOpts{ | ||||||||||
| Name: "debuginfo_validate_object_file_attempts_total", | ||||||||||
| Help: "Total number of validation of object file.", | ||||||||||
| }, | ||||||||||
| ) | ||||||||||
| validationErrorsTotal := prometheus.NewCounterVec( | ||||||||||
| prometheus.CounterOpts{ | ||||||||||
| Name: "debuginfo_validate_object_file_errors_total", | ||||||||||
| Help: "Total number of errors in validationg object file.", | ||||||||||
| }, | ||||||||||
| []string{"reason"}, | ||||||||||
| ) | ||||||||||
| return &Store{ | ||||||||||
| tracer: tracer, | ||||||||||
| logger: log.With(logger, "component", "debuginfo"), | ||||||||||
| bucket: bucket, | ||||||||||
| cacheDir: cacheDir, | ||||||||||
| metadata: metadata, | ||||||||||
| debuginfodClient: debuginfodClient, | ||||||||||
| tracer: tracer, | ||||||||||
| logger: log.With(logger, "component", "debuginfo"), | ||||||||||
| bucket: bucket, | ||||||||||
| cacheDir: cacheDir, | ||||||||||
| metadata: metadata, | ||||||||||
| debuginfodClient: debuginfodClient, | ||||||||||
| metadataUpdateDuration: metadataUpdateDuration, | ||||||||||
| validationAttemptsTotal: validationAttemptsTotal, | ||||||||||
| validationErrorsTotal: *validationErrorsTotal, | ||||||||||
| uploadDebugInfoAttemptsTotal: uploadDebugInfoAttemptsTotal, | ||||||||||
|
||||||||||
| uploadDebugInfoAttemptsTotal: uploadDebugInfoAttemptsTotal, | |
| debugInfoUploadAttemptsTotal: uploadDebugInfoAttemptsTotal, |
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.
| uploadDebugInfoAttemptsTotal: uploadDebugInfoAttemptsTotal, | |
| debugInfoUploadAttemptsTotal: uploadDebugInfoAttemptsTotal, |
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.
Thanks for the suggestion. I'll make the changes.
Outdated
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.
| uploadDebugInfoErrorsTotal: *uploadDebugInfoErrorsTotal, | |
| debugInfoUploadErrorsTotal: *uploadDebugInfoErrorsTotal, |
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.
+1. will make the changes
Outdated
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.
| uploadDebugInfoDuration: uploadDebugInfoDuration, | |
| debugInfoUploadDuration: uploadDebugInfoDuration, |
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.
will make the changes
Outdated
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 don't think this is semantically correct. There are lots of other operations happening in the rest of the method.
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.
yes. thanks for correcting it. I think I cannot use defer here. I'll update the PR
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.
We should encapsulate this in metadata types and files rather than here.
Uh oh!
There was an error while loading. Please reload this page.
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.
A small doubt on this. I think We can move
metadataUpdateDurationto metadata.go and encapsulate insideObjectStoreMetadata struct. I'm not sure this comment forvalidationAttemptsTotalandvalidationErrorsTotal. Currently validation metrics are around thisparca/pkg/debuginfo/store.go
Line 302 in 573a48d
Could you please clarify this?
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.
Maybe we don't need those at all. Considering we'll always try to validate these files, maybe just having the duration is enough. What do you think?
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.
nice. It's clear now. I'll update the PR