Can you replace dash in metric name with underscore?Monitoring log files using some metrics exporter + Prometheus + GrafanaHow to scale prometheus in kubernetes environmentInter-pod communication in kubernetesPrometheus dynamic alertingPrometheus 1.8/2.2.1 scrape gives “no token” error - promtool shows only a few warningsQuery on custom metrics exposed via prometheus node exporter textfile collector failsPrometheus bulk importPrometheus Scraping from centralized services. Can such architecture skew the metrics?Get data from prometheus only from last scrape iterationFiltering Enabled Collectors
Would a carnivorous diet be able to support a giant worm?
What is the minimum time required for final wash in film development?
Given a 32 bit number, what is an efficient way to scale each byte by a certain factor?
The rigidity of the countable product of free groups
What minifigure is this?
Should I include code in my research paper?
How can I effectively communicate to recruiters that a phone call is not possible?
When did "&" stop being taught alongside the alphabet?
How do you move up one folder in Finder?
Why does the Antonov AN-225 not have any winglets?
How often does the spell Sleet Storm require concentration checks?
Backspace functionality in normal mode
Are there any sports for which the world's best player is female?
Why is the ladder of the LM always in the dark side of the LM?
Through: how to use it with subtraction of functions?
LED glows slightly during soldering
Why would people still be chanting "Lock her up" at Trump rallies in 2019?
What happens to unproductive professors?
Yet another hash table in C
Number of short hairs coming out of the base of the head Tefillin
Why weren't bootable game disks ever a thing on the IBM PC?
Graduate student with abysmal English writing skills, how to help
Efficiently defining a SparseArray function
Could you brine steak?
Can you replace dash in metric name with underscore?
Monitoring log files using some metrics exporter + Prometheus + GrafanaHow to scale prometheus in kubernetes environmentInter-pod communication in kubernetesPrometheus dynamic alertingPrometheus 1.8/2.2.1 scrape gives “no token” error - promtool shows only a few warningsQuery on custom metrics exposed via prometheus node exporter textfile collector failsPrometheus bulk importPrometheus Scraping from centralized services. Can such architecture skew the metrics?Get data from prometheus only from last scrape iterationFiltering Enabled Collectors
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am scraping an exporter that gives me metric names with dashes. Prometheus metric names cannot have dashes so I fail to scrape those metrics.
Is it possible to replace the dash with an underscore to make the metric name valid?
- Current:
collectd_a-b_derive_total
. - Desired:
collectd_a_b_derive_total
.
I added this to my config but it does not appear to work.
- source_labels: [__name__]
regex: "(.*)-(.*)"
action: replace
target_label: "$1_$2"
Also, what is a good way to debug this?
prometheus
add a comment |
I am scraping an exporter that gives me metric names with dashes. Prometheus metric names cannot have dashes so I fail to scrape those metrics.
Is it possible to replace the dash with an underscore to make the metric name valid?
- Current:
collectd_a-b_derive_total
. - Desired:
collectd_a_b_derive_total
.
I added this to my config but it does not appear to work.
- source_labels: [__name__]
regex: "(.*)-(.*)"
action: replace
target_label: "$1_$2"
Also, what is a good way to debug this?
prometheus
add a comment |
I am scraping an exporter that gives me metric names with dashes. Prometheus metric names cannot have dashes so I fail to scrape those metrics.
Is it possible to replace the dash with an underscore to make the metric name valid?
- Current:
collectd_a-b_derive_total
. - Desired:
collectd_a_b_derive_total
.
I added this to my config but it does not appear to work.
- source_labels: [__name__]
regex: "(.*)-(.*)"
action: replace
target_label: "$1_$2"
Also, what is a good way to debug this?
prometheus
I am scraping an exporter that gives me metric names with dashes. Prometheus metric names cannot have dashes so I fail to scrape those metrics.
Is it possible to replace the dash with an underscore to make the metric name valid?
- Current:
collectd_a-b_derive_total
. - Desired:
collectd_a_b_derive_total
.
I added this to my config but it does not appear to work.
- source_labels: [__name__]
regex: "(.*)-(.*)"
action: replace
target_label: "$1_$2"
Also, what is a good way to debug this?
prometheus
prometheus
asked Mar 26 at 0:53
Martin VelezMartin Velez
1,1217 silver badges23 bronze badges
1,1217 silver badges23 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I emailed the prometheus-users mailing list and someone responded that Prometheus cannot "fix" metric names with dashes/hyphens.
Since, I prefer to not edit the application emitting the metrics, I found a workaround.
- Set up Nginx.
- Configure it as a reverse proxy.
- Listen on 19103.
- Get and rewrite body from 9103 using Nginx's sub_filter directive.
- Configure Prometheus to scrape 19103 instead of 9103.
Sample reverse-proxy.conf:
server
listen 19103;
location /
proxy_pass http://127.0.0.1:9103;
sub_filter_types *;
sub_filter 'purple-' 'purple_';
sub_filter_once off;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348389%2fcan-you-replace-dash-in-metric-name-with-underscore%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I emailed the prometheus-users mailing list and someone responded that Prometheus cannot "fix" metric names with dashes/hyphens.
Since, I prefer to not edit the application emitting the metrics, I found a workaround.
- Set up Nginx.
- Configure it as a reverse proxy.
- Listen on 19103.
- Get and rewrite body from 9103 using Nginx's sub_filter directive.
- Configure Prometheus to scrape 19103 instead of 9103.
Sample reverse-proxy.conf:
server
listen 19103;
location /
proxy_pass http://127.0.0.1:9103;
sub_filter_types *;
sub_filter 'purple-' 'purple_';
sub_filter_once off;
add a comment |
I emailed the prometheus-users mailing list and someone responded that Prometheus cannot "fix" metric names with dashes/hyphens.
Since, I prefer to not edit the application emitting the metrics, I found a workaround.
- Set up Nginx.
- Configure it as a reverse proxy.
- Listen on 19103.
- Get and rewrite body from 9103 using Nginx's sub_filter directive.
- Configure Prometheus to scrape 19103 instead of 9103.
Sample reverse-proxy.conf:
server
listen 19103;
location /
proxy_pass http://127.0.0.1:9103;
sub_filter_types *;
sub_filter 'purple-' 'purple_';
sub_filter_once off;
add a comment |
I emailed the prometheus-users mailing list and someone responded that Prometheus cannot "fix" metric names with dashes/hyphens.
Since, I prefer to not edit the application emitting the metrics, I found a workaround.
- Set up Nginx.
- Configure it as a reverse proxy.
- Listen on 19103.
- Get and rewrite body from 9103 using Nginx's sub_filter directive.
- Configure Prometheus to scrape 19103 instead of 9103.
Sample reverse-proxy.conf:
server
listen 19103;
location /
proxy_pass http://127.0.0.1:9103;
sub_filter_types *;
sub_filter 'purple-' 'purple_';
sub_filter_once off;
I emailed the prometheus-users mailing list and someone responded that Prometheus cannot "fix" metric names with dashes/hyphens.
Since, I prefer to not edit the application emitting the metrics, I found a workaround.
- Set up Nginx.
- Configure it as a reverse proxy.
- Listen on 19103.
- Get and rewrite body from 9103 using Nginx's sub_filter directive.
- Configure Prometheus to scrape 19103 instead of 9103.
Sample reverse-proxy.conf:
server
listen 19103;
location /
proxy_pass http://127.0.0.1:9103;
sub_filter_types *;
sub_filter 'purple-' 'purple_';
sub_filter_once off;
answered Mar 28 at 18:03
Martin VelezMartin Velez
1,1217 silver badges23 bronze badges
1,1217 silver badges23 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348389%2fcan-you-replace-dash-in-metric-name-with-underscore%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown