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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현