fix(exporter-prometheus): add appendTimestamp option to ExporterConfig#1697
fix(exporter-prometheus): add appendTimestamp option to ExporterConfig#1697obecny merged 12 commits intoopen-telemetry:masterfrom antoniomrfranco:exporter-prometheus-fix-append-timestamp
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>
legendecas
left a comment
There was a problem hiding this comment.
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>
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 |
dyladan
left a comment
There was a problem hiding this comment.
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?
PrometheusSerializerhas 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
appendTimestampoption 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.,appendTimestampdefaults totrue.