-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ping metrics #23
Ping metrics #23
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
8dfe88a
to
ce1767e
Compare
the diff looks like it contains things from #22 - maybe rebase just in this case? |
This comment was marked as outdated.
This comment was marked as outdated.
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.
the implementation looks good to me.
could you make this feature available behind a flag or query parameter though?
i'm not sure all users of this service want to cause these additional requests to the API.
Sure, you got some name in mind? Previous iterations used The former name stemmed from the API endpoint ( Maybe something akin to |
This is in preparation to fetch ping statistics from UNMS. The endpoint returns A LOT more data, but for now this contains only the minimal set.
This enables fetching device statistics from UNMS, extracting the ping RTT values from it, and export them back to prometheus. Since fetching statistics requires talking to another, device-specific endpoint, the context timeout is increased from 5 to 30s. A future change should pass the request context from the promhttp endpoint down to the fetchDeviceData() method, to make the timout depend on Prometheus' scrape request life cycle.
This comment was marked as outdated.
This comment was marked as outdated.
you can use |
This comment was marked as outdated.
This comment was marked as outdated.
wait, i have a feeling you're confusing some things here:
so setting |
You're right, I tripped over that.
Already done here. That's not it. I'd probably need to set I've settled on a single config word ( |
if you want to resolve the conflicts, this might be good to go! |
Done. I had to re-introduce the |
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.
one thing
@@ -241,6 +247,21 @@ func (e *Exporter) collectImpl(ctx context.Context, out chan<- prom.Metric) erro | |||
out <- e.newMetric("wan_rx_rate", prom.GaugeValue, wanIF.Statistics.Rxrate, deviceLabels...) | |||
out <- e.newMetric("wan_tx_rate", prom.GaugeValue, wanIF.Statistics.Txrate, deviceLabels...) | |||
} | |||
|
|||
// Ping metrics, if enabled | |||
if e.extras.Ping { |
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.
do you need to check this here? should be fine to use the nil-check in PingMetrics right? that way the fetchDeviceData
is the only place it's handled, which i'd like.
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'd rather leave it as is, because future extensions to the models.DeviceStatistics
struct (hint: coming very soon) will require this conditional where it is now.
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.
interesting feature. thanks for the contribution!
This enables fetching device statistics from UNMS, extracting the ping RTT values from it, and export them back to Prometheus.