Skip to content

feat: add Prometheus worker metrics and enhance webhook signature ver… - #172

Merged
mergekeeper[bot] merged 4 commits into
ASTROIDX556:mainfrom
Hotmopo:feat/prometheus-worker-metrics-and-webhook-verification
Aug 31, 2026
Merged

feat: add Prometheus worker metrics and enhance webhook signature ver…#172
mergekeeper[bot] merged 4 commits into
ASTROIDX556:mainfrom
Hotmopo:feat/prometheus-worker-metrics-and-webhook-verification

Conversation

@Hotmopo

@Hotmopo Hotmopo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

…ification

Closes #73
Closes #74

#73 — Prometheus metrics exporter for queue depths and worker latencies

  • Added worker_job_duration_seconds histogram and worker_jobs_total counter to MetricsService for tracking BullMQ worker processing latency and outcomes
  • Created WorkerMetricsService with an instrumentJob() wrapper that automatically measures job execution time and records success/failure
  • Wired metrics into all workers (webhook delivery, notification delivery, analytics aggregation, balance sync) via optional WorkerMetricsService injection
  • Updated WebhooksProcessor to track delivery latency and outcomes
  • Added MetricsModule import to WebhookModule and WorkersModule
  • Added comprehensive unit tests for WorkerMetricsService and new metric collection

#74 — Cryptographic verification middleware for incoming webhook signatures

  • Created RawBodyMiddleware for capturing raw request body before JSON parsing, ensuring accurate HMAC computation on webhook endpoints
  • Enhanced WebhookSignatureGuard with configurable per-integration secret resolution via WebhookSecretResolver callback and WebhookSignatureGuardOptions
  • Added WEBHOOK_SIGNING_SECRET env var as additional fallback
  • Added descriptive error response when no signing secret is configured
  • Extended tests: per-integration secrets, custom tolerance, raw body extraction, missing headers, non-numeric timestamps, no-secret-configured scenarios

Summary

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling

Related issue

Closes #

Checklist

  • npm run build passes
  • npm test passes
  • npm run lint passes
  • npm run typecheck passes
  • No secrets added to tracked files
  • PR description explains the why, not just the what

…ification

Closes ASTROIDX556#73
Closes ASTROIDX556#74

ASTROIDX556#73 — Prometheus metrics exporter for queue depths and worker latencies

- Added `worker_job_duration_seconds` histogram and `worker_jobs_total` counter
  to MetricsService for tracking BullMQ worker processing latency and outcomes
- Created `WorkerMetricsService` with an `instrumentJob()` wrapper that
  automatically measures job execution time and records success/failure
- Wired metrics into all workers (webhook delivery, notification delivery,
  analytics aggregation, balance sync) via optional WorkerMetricsService injection
- Updated WebhooksProcessor to track delivery latency and outcomes
- Added MetricsModule import to WebhookModule and WorkersModule
- Added comprehensive unit tests for WorkerMetricsService and new metric collection

ASTROIDX556#74 — Cryptographic verification middleware for incoming webhook signatures

- Created `RawBodyMiddleware` for capturing raw request body before JSON parsing,
  ensuring accurate HMAC computation on webhook endpoints
- Enhanced `WebhookSignatureGuard` with configurable per-integration secret
  resolution via `WebhookSecretResolver` callback and `WebhookSignatureGuardOptions`
- Added `WEBHOOK_SIGNING_SECRET` env var as additional fallback
- Added descriptive error response when no signing secret is configured
- Extended tests: per-integration secrets, custom tolerance, raw body extraction,
  missing headers, non-numeric timestamps, no-secret-configured scenarios

Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Hotmopo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown

MergeKeeper review

Scope: in scope for linked issue #73.
Verdict: clean

The PR successfully implements the Prometheus metrics exporter for queue depths/worker latencies (#73) and the cryptographic webhook signature verification middleware (#74) with complete unit test coverage.

Reviewed commit: cb8eb90df044a9ee902ea06301e3eb02b15fddbb.
CI and merge eligibility are checked separately.

@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown

MergeKeeper merge status

Status: blocked
PR state: open
Mergeability: mergeable
Checked commit: 4f289b0abfb328ffb6ac2c7e3b3ea49c8d514e6d.

Reason: One or more required CI checks failed.

Failing checks:

Next steps:

  1. Open the failing check details above and fix the reported error.
  2. Run the same checks locally where possible.
  3. Commit and push the fix.
  4. MergeKeeper will automatically re-review the updated PR.

@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown

MergeKeeper review unavailable

AI provider review response did not contain valid JSON

No approval or merge action was taken.

Move Express Request type augmentation to a separate .d.ts file
to avoid @typescript-eslint/no-namespace, and replace `as any` casts
in the test file with properly typed mock objects to satisfy
@typescript-eslint/no-explicit-any.

Co-Authored-By: Codebuff <noreply@codebuff.com>

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

The PR successfully implements the Prometheus metrics exporter for queue depths/worker latencies (#73) and the cryptographic webhook signature verification middleware (#74) with complete unit test coverage.

@mergekeeper
mergekeeper Bot merged commit 04744c8 into ASTROIDX556:main Aug 31, 2026
4 checks passed
@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown

Merged

Merged with squash.

lewistemple22 pushed a commit to lewistemple22/astroid-api that referenced this pull request Aug 31, 2026
ASTROIDX556#172)

* feat: add Prometheus worker metrics and enhance webhook signature verification

Closes ASTROIDX556#73
Closes ASTROIDX556#74

ASTROIDX556#73 — Prometheus metrics exporter for queue depths and worker latencies

- Added `worker_job_duration_seconds` histogram and `worker_jobs_total` counter
  to MetricsService for tracking BullMQ worker processing latency and outcomes
- Created `WorkerMetricsService` with an `instrumentJob()` wrapper that
  automatically measures job execution time and records success/failure
- Wired metrics into all workers (webhook delivery, notification delivery,
  analytics aggregation, balance sync) via optional WorkerMetricsService injection
- Updated WebhooksProcessor to track delivery latency and outcomes
- Added MetricsModule import to WebhookModule and WorkersModule
- Added comprehensive unit tests for WorkerMetricsService and new metric collection

ASTROIDX556#74 — Cryptographic verification middleware for incoming webhook signatures

- Created `RawBodyMiddleware` for capturing raw request body before JSON parsing,
  ensuring accurate HMAC computation on webhook endpoints
- Enhanced `WebhookSignatureGuard` with configurable per-integration secret
  resolution via `WebhookSecretResolver` callback and `WebhookSignatureGuardOptions`
- Added `WEBHOOK_SIGNING_SECRET` env var as additional fallback
- Added descriptive error response when no signing secret is configured
- Extended tests: per-integration secrets, custom tolerance, raw body extraction,
  missing headers, non-numeric timestamps, no-secret-configured scenarios

Co-Authored-By: Codebuff <noreply@codebuff.com>

* fix: resolve ESLint errors in raw-body middleware

Move Express Request type augmentation to a separate .d.ts file
to avoid @typescript-eslint/no-namespace, and replace `as any` casts
in the test file with properly typed mock objects to satisfy
@typescript-eslint/no-explicit-any.

Co-Authored-By: Codebuff <noreply@codebuff.com>

---------

Co-authored-by: Hotmopo <297505646+Hotmopo@users.noreply.github.com>
Co-authored-by: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant