Add myshoes_webhook_jobs_enqueued_total for auto-scaling from metrics#235
Merged
Add myshoes_webhook_jobs_enqueued_total for auto-scaling from metrics#235
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Prometheus metric (myshoes_webhook_jobs_enqueued_total) to support auto-scaling based on webhook activity and integrates metric tracking into webhook event handling.
- Introduces new metric counters and histograms in pkg/metric/webhook.go.
- Updates webhook event handling in pkg/web/webhook.go to record success, error, and processing duration metrics for various event types.
- Bumps dependency versions in go.mod to compatible releases.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/web/webhook.go | Adds metric instrumentation within webhook processing and job enqueuing logic. |
| pkg/metric/webhook.go | Introduces new Prometheus metrics for webhook events and job enqueuing. |
| go.mod | Updates versions for several dependencies. |
Comments suppressed due to low confidence (1)
pkg/web/webhook.go:218
- The variable 'labels' is undefined in this scope. Ensure that 'labels' is properly defined or passed in before using it to compute 'runsOn' for the workflow_job metric.
runsOn := strings.Join(labels, ",")
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces updates to dependencies in
go.modand enhances webhook handling inpkg/web/webhook.gowith new Prometheus metrics. The changes improve observability of webhook processing and job enqueuing while updating dependencies to their latest versions for better performance and compatibility.Dependency Updates:
go.modto newer versions, includinggithub.com/google/go-cmp,github.com/prometheus/client_golang,golang.org/x/sync,google.golang.org/protobuf, andgolang.org/x/crypto, among others. These updates ensure compatibility and may include performance improvements or bug fixes. [1] [2]github.com/klauspost/compressfrom indirect dependencies ingo.mod, simplifying the dependency graph.Webhook Metrics Enhancements:
pkg/metric/webhook.goto define new Prometheus metrics (WebhookReceivedTotal,WebhookProcessingDuration, andWebhookJobsEnqueued) for tracking webhook events, processing duration, and job enqueuing.pkg/web/webhook.goto record webhook processing outcomes, durations, and job enqueuing for various event types (ping,check_run,workflow_job). This improves observability and debugging capabilities. [1] [2] [3]Webhook Event Handling Improvements:
HandleGitHubEventto extractruns-onlabels forworkflow_jobevents, enabling more detailed metrics.receiveCheckRunWebhookandreceiveWorkflowJobWebhookfunctions to record metrics for jobs enqueued during webhook processing. [1] [2]