-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for Prometheus' start time metric #394
Conversation
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
==========================================
- Coverage 74.46% 74.22% -0.24%
==========================================
Files 116 116
Lines 6997 7026 +29
==========================================
+ Hits 5210 5215 +5
- Misses 1527 1549 +22
- Partials 260 262 +2
Continue to review full report at Codecov.
|
@rghetia - ptal |
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 except for one minor nit.
droppedTimeseries = numTimeseries | ||
} else { | ||
adjustStartTime(tr.metricBuilder.startTime, metrics) | ||
} |
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.
IMO, it would be more readable to have following
if tr.useStartTimeMetric {
// adjustStartTime
} else {
// AdjustMetrics. jobsMap has to be non-nil in this case.
}
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.
Done
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. One related q but not from your change.
droppedTimeseries int | ||
useStartTimeMetric bool | ||
startTime float64 | ||
logger *zap.SugaredLogger |
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.
Q.: this is not a change but typically we use *zap.Logger
. Are you aware of any specific reason to use the SugaredLogger
? The former is strong typed and as result a bit more verbose on the source but the rest of the code base already uses it....
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.
I'm not sure why the original author used SugaredLogger but I don't see any particular need for it - I can write a follow-up pr to remove it.
Fix misspelling of opentelemetry.
* add OpenTelemetry demo example * Update Makefile Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Prometheus clients can optionally export a standard start-time gauge metric, process_start_time_seconds, that greatly simplifies the logic necessary for setting the start timestamp for exported timeseries, which removes the overhead of the metrics adjuster.
This change adds a configuration option to use the start-time metric. If the start-time metric is not found in a scrape, the timeseries for that scrape are dropped.
Note that the start-time timeseries is not exported by the prometheus receiver as a metric (i.e. not passed to ConsumeMetricsData).