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;








1















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?










share|improve this question




























    1















    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?










    share|improve this question
























      1












      1








      1








      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?










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 0:53









      Martin VelezMartin Velez

      1,1217 silver badges23 bronze badges




      1,1217 silver badges23 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.



          1. Set up Nginx.

          2. Configure it as a reverse proxy.

            • Listen on 19103.

            • Get and rewrite body from 9103 using Nginx's sub_filter directive.


          3. 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;







          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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.



            1. Set up Nginx.

            2. Configure it as a reverse proxy.

              • Listen on 19103.

              • Get and rewrite body from 9103 using Nginx's sub_filter directive.


            3. 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;







            share|improve this answer



























              0














              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.



              1. Set up Nginx.

              2. Configure it as a reverse proxy.

                • Listen on 19103.

                • Get and rewrite body from 9103 using Nginx's sub_filter directive.


              3. 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;







              share|improve this answer

























                0












                0








                0







                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.



                1. Set up Nginx.

                2. Configure it as a reverse proxy.

                  • Listen on 19103.

                  • Get and rewrite body from 9103 using Nginx's sub_filter directive.


                3. 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;







                share|improve this answer













                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.



                1. Set up Nginx.

                2. Configure it as a reverse proxy.

                  • Listen on 19103.

                  • Get and rewrite body from 9103 using Nginx's sub_filter directive.


                3. 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;








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 18:03









                Martin VelezMartin Velez

                1,1217 silver badges23 bronze badges




                1,1217 silver badges23 bronze badges


















                    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.



















                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴