x509 otel certificate refresh events in cert_refresher library.#3146
x509 otel certificate refresh events in cert_refresher library.#3146havetisyan merged 6 commits intoAthenZ:masterfrom
Conversation
Summary of ChangesHello @balamanova, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces OpenTelemetry metrics for X.509 certificate refresh events by adding a new OpenTelemetryCertReloadEventEmitter class and integrating it into the KeyRefresher. The implementation is solid, adding valuable observability. My review includes several suggestions for the new OpenTelemetryCertReloadEventEmitter class to improve metric consistency, code clarity, and the utility of the emitted metrics. These changes will make the new telemetry data more robust and easier to consume.
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
bc60e29 to
c9e32ba
Compare
ATHENS-8722 adding cert refresh metrics Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
c9e32ba to
522931a
Compare
libs/java/cert_refresher/src/main/java/com/oath/auth/KeyRefresher.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
| .build(); | ||
|
|
||
| refreshResultCounter.add(1, attrs); | ||
| resultLastTimestampGauge.set(timestamp, attrs); |
There was a problem hiding this comment.
do we need to send timestamp explicity, won't that be automatically be available with refreshResultCounter?
There was a problem hiding this comment.
I'm using OTel Metrics API (counter + gauge), not OTel Events/Logs API. Prometheus is a pull-based time-series database.
Prometheus only stores scrape timestamps, not event timestamps. I can detect that a refresh happened using increase(), but the timestamp is approximate (within scrape interval).
With this timestamp I save exact timestamp when the refresh occurred
There was a problem hiding this comment.
there is no need to generate a timestamp attribute. the metric already tells you that there is a failure in the given time period and the exact timestamp is not really needed and will not be used.
…tMetric Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
9b54ae6 to
8adce7d
Compare
libs/java/cert_refresher/src/main/java/com/oath/auth/KeyRefresher.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/KeyRefresher.java
Outdated
Show resolved
Hide resolved
| .build(); | ||
|
|
||
| refreshResultCounter.add(1, attrs); | ||
| resultLastTimestampGauge.set(timestamp, attrs); |
There was a problem hiding this comment.
there is no need to generate a timestamp attribute. the metric already tells you that there is a failure in the given time period and the exact timestamp is not really needed and will not be used.
Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
libs/java/cert_refresher/src/main/java/com/oath/auth/KeyRefresher.java
Outdated
Show resolved
Hide resolved
libs/java/cert_refresher/src/main/java/com/oath/auth/OpenTelemetryCertReloadEventEmitter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
5b4d5d8 to
920430e
Compare
Signed-off-by: abalamanova <assem.balamanova@yahooinc.com>
Description
Added OpenTelemetry metrics for X.509 certificate refresh events in
cert_refresherlibrary.Implementation follows SIA OTel pattern
This implementation mirrors the existing SIA (Go) OTel metrics pattern from
libs/go/sia/otel/metricset.go:Metrics (aligned with SIA)
athenz_cert_refresher.refresh.result_total{function,result}sia.agent_command.result_total{function,result}athenz_cert_refresher.service_cert.validity.remaining_secs{name}sia.service_cert.validity.remaining_secs{cname}athenz_cert_refresher.refresh.result_last_timestamp{function,result}Attributes (same as SIA)
function- identifies the operation (e.g., "cert_refresh")result- "success" or "failure" (same values as SIA)name- certificate subject name (similar to SIA'scname)Configuration
-Dathenz.cert_refresher.otel_disabled=true-Dathenz.cert_refresher.otel_component_name=my-serviceContribution Checklist:
Attach Screenshots (Optional)