Skip to content

feat(PVO11Y-4761): Add Kanary signal exporter #574

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FaisalAl-Rayes
Copy link
Collaborator

@FaisalAl-Rayes FaisalAl-Rayes commented May 21, 2025

This commit introduces a new exporter to fetch Kanary signal values from a database and expose them as Prometheus metrics.

Includes:

  • Core exporter logic for PostgreSQL.
  • kanary_signal metric with cluster and status labels.
  • kanary_interruption metric with cluster and reason labels
  • Unit tests using sqlmock.
  • README.md

@FaisalAl-Rayes FaisalAl-Rayes requested a review from kubasikus May 21, 2025 12:32
@FaisalAl-Rayes FaisalAl-Rayes force-pushed the kanary-signal-exporter branch from d3779d6 to 6a403f0 Compare May 22, 2025 07:38
@FaisalAl-Rayes
Copy link
Collaborator Author

Depends on #576

@FaisalAl-Rayes
Copy link
Collaborator Author

/retest

@FaisalAl-Rayes FaisalAl-Rayes marked this pull request as ready for review May 26, 2025 11:59
@FaisalAl-Rayes FaisalAl-Rayes requested review from raks-tt, martysp21 and pacho-rh and removed request for raks-tt, martysp21 and pacho-rh May 27, 2025 08:16
if err != nil {
log.Fatalf("FATAL: Error connecting to the database using DSN from %s: %v", dbURLEnvVar, err)
}
defer db.Close()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would move the defer Close right after opening, so the open and error logic are together.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, moving it now

Copy link
Collaborator

Choose a reason for hiding this comment

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

The defer is at multiple places following the same patter: open, error, close
It would make sense to move the close in other places as well.

@FaisalAl-Rayes FaisalAl-Rayes force-pushed the kanary-signal-exporter branch 2 times, most recently from e697cd6 to 23ba13a Compare May 27, 2025 11:53
@FaisalAl-Rayes FaisalAl-Rayes requested review from martysp21 and removed request for kubasikus, pacho-rh, raks-tt and martysp21 May 27, 2025 11:59
@FaisalAl-Rayes FaisalAl-Rayes marked this pull request as draft May 27, 2025 12:40
@FaisalAl-Rayes FaisalAl-Rayes force-pushed the kanary-signal-exporter branch 2 times, most recently from d9cfc2f to 857f5c0 Compare May 28, 2025 07:56
This commit introduces a new exporter to fetch Kanary signal values
from a database and expose them as Prometheus metrics.

Includes:
- Core exporter logic for PostgreSQL.
- `kanary_signal` metric with `cluster` and `status` labels.
- `kanary_interruption` metric with `cluster` and `reason` labels
- Use PedanticRegistry to control exposed Prometheus metrics. This ensures only explicitly registered application metrics are exported.
- Unit tests using sqlmock.
- README.md

Signed-off-by: Faisal Al-Rayes <[email protected]>
@FaisalAl-Rayes FaisalAl-Rayes force-pushed the kanary-signal-exporter branch from 857f5c0 to 042b9e2 Compare May 28, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants