-
Notifications
You must be signed in to change notification settings - Fork 13
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
[terafoundation] Prom metrics exporter doesn't reset metrics between updates #3747
Conversation
Uh, I completely forgot about this ...
compared to:
We should document the existence of this capability and we should really consider expanding the labels coming out of it or consolidating these metrics in with the new main built in exporter. |
cluster === teraslice.name from the terafoundation, correct? Which is what is returned in the request above. |
Correct |
36abb5d
to
138ce2b
Compare
I added an example in the endpoints-json.md file |
this.context.apis.foundation.promMetrics.set( | ||
'master_info', | ||
{ | ||
arch: this.context.arch, | ||
clustering_type: cluster_manager_type, | ||
name, | ||
node_version: process.version, | ||
platform: this.context.platform, | ||
teraslice_version: getPackageJSON().version | ||
}, | ||
1 | ||
); |
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.
Does url
get added to master_info
somewhere else?
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.
Yes. url
, assignment
, and name
are default labels that are added to all metrics automatically within the PromMetrics
class.
url: prom_metrics_display_url, |
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 name
label is being set as a default and in the cluster_info
metric. Within promMetrics.set()
the default labels will override the labels passed in as parameters, so there is no chance of labels repeating.
# HELP teraslice_master_info Information about Teraslice cluster master
# TYPE teraslice_master_info gauge
teraslice_master_info{arch="arm64",clustering_type="kubernetes",name="ts-dev1",node_version="v18.20.4",platform="linux",teraslice_version="2.3.1",assignment="master"} 1
This PR makes the following changes:
PromMetrics
class needs to reset it's list of metrics on each scrape. If it doesn't do this, then all the executions are listed, not just the active ones.resetMetrics()
functions were added toPromMetrics
andExporter
to reset theprom-client
register.prom_metrics_display_url
field to terafoundation. This value will be used as theurl
default label added to all prom metrics. Defaults to an empty string, making it more obvious that this field is missing from the config.ref: #3743