-
Notifications
You must be signed in to change notification settings - Fork 806
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
fix(exporter-prometheus): add appendTimestamp option to ExporterConfig #1697
fix(exporter-prometheus): add appendTimestamp option to ExporterConfig #1697
Conversation
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
|
Codecov Report
@@ Coverage Diff @@
## master #1697 +/- ##
=======================================
Coverage 92.17% 92.17%
=======================================
Files 167 167
Lines 5594 5597 +3
Branches 1191 1193 +2
=======================================
+ Hits 5156 5159 +3
Misses 438 438
|
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
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.
Welcome to the project :). LGTM.
packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
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.
lgtm, just last minor thing
packages/opentelemetry-exporter-prometheus/src/PrometheusExporter.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
Signed-off-by: Antonio Franco <antoniomrfranco@gmail.com>
It seems that the lint check broke after I updated my branch merging |
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.
Looks fine but why is this configurable in the first place? Shouldn't we always append the timestamp?
Hi @dyladan. I don't think we should always append the timestamp. Actually, in Prometheus docs, they say that
So I think that timestamp is only required when you have a Pushgateway or a federated architecture (e.g., Prometheus pushing metrics to Cortex). |
In that case, should we remove the timestamp option? Sounds like prometheus itself doesn't recommend its use. |
packages/opentelemetry-exporter-prometheus/test/PrometheusExporter.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Which problem is this PR solving?
PrometheusSerializer
has a property calledappendTimestamp
. However, this property cannot be changed anywhere. This PR fixes this issue, which is also discussed in Question: best way to set PrometheusExporter._serializer._appendTimestamp = false #1695.Short description of the changes
appendTimestamp
option toExporterConfig
. This option is used to control whether the timestamp will be included when exporting the metric or not. The default behavior was not changed, i.e.,appendTimestamp
defaults totrue
.