-
Notifications
You must be signed in to change notification settings - Fork 29
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
extend metrics for github and provider executions #217
extend metrics for github and provider executions #217
Conversation
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
introduce metrics counter for github api calls Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
metrics.GithubOperationFailedCount.WithLabelValues( | ||
"GenerateEnterpriseJITConfig", // label: operation | ||
metricsLabelEnterpriseScope, // label: scope | ||
).Inc() | ||
if resp != nil && resp.StatusCode == http.StatusUnauthorized { | ||
return nil, nil, fmt.Errorf("failed to get JIT config: %w", 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.
no related to this change.
Note to self: This needs to wrap runnerErrors.ErrUnauthorized
This looks good to me. All this makes me think we might benefit from some telemetry as well. Maybe in a future release we could leverage OpenTelemetry. I could merge this if you're satisfied with it. Let me know. If you're still working on it, feel free to convert it to draft so I don't accidentally merge it prematurely 😁 |
OpenTelemetry is definitely (IMHO) the next thing when it came to observability. TBH i didn't spend that much time into it to understand how/what we need on our side to use it within our company internal managed prometheus service. Will convert the PR to draft to finalize it tomorrow morning (especially the second round of looking for external api-calls). |
definitely something for future releases, not even for the next one. otel allows us to trace calls throughout the codebase and allows us to add context to those traces, like what we're calling functions with, what error they return. With that info, we can then generate detailed graphs of how a call traveled throughout the code base. Further more, this can be correlated even with external providers. But again, this is for much further into the future. For now, and especially in this PR, metrics are the focus. |
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
377839d
to
d68cc3b
Compare
I've found three other API calls i missed in the first round - but for now it looks good - feel free to merge whenever you want |
extend metrics for github and provider executions
This PR add couple of new metrics to count interactions with the github API and external provider binaries.
i've followed the recommendation of the prometheus-folks when it came to metrics for this kind of problem: https://promlabs.com/blog/2023/09/19/errors-successes-totals-which-metrics-should-i-expose-to-prometheus/#recommended-for-binary-outcomes-exposing-errors-and-totals
provider binary example metrics:
github api call example metrics:
towards #181
TODO:
golangci.yml
with metrics linter --> will do another PR with a firstgolangci.yaml
for this project