“t.data.data is undefined” in grafana












0















I'm new to micrometer, prometheus and grafana. I'm trying to run my first example with these three things working together. But I'm having a hard time figuring out what I'm doing wrong.



I'm using micrometer's API to create a PrometheusMeterRegistry like this:



new PrometheusMeterRegistry(new PrometheusConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(10);
}

@Override
@Nullable
public String get(String k) {
return null;
}
});


And I'm creating a HttpServer as described here using the following code:



try {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
server.createContext("/prometheus", httpExchange -> {
String response = prometheusMeterRegistry.scrape();
httpExchange.sendResponseHeaders(200, response.getBytes().length);
try (OutputStream os = httpExchange.getResponseBody()) {
os.write(response.getBytes());
}
});

new Thread(server::start).start();
} catch (IOException e) {
throw new RuntimeException(e);
}


I configured Prometheus as my data-source in grafana and set the URL to http://localhost:8080/prometheus. But when I try creating a new dashboard and add a graph to it, I get a red exclamation mark saying t.data.data is undefined. And because of this I'm not able to view the graphs. The complete stack-trace is as follows:



kr</t.prototype.transform@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:723420
jr</t.prototype.query/</<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:736135
qt@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:5239
Wa@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:40274
jr</t.prototype.query/<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:735858
c/</<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92198
c/<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92043
$digest@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:97575
$apply@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99590
$applyAsync/r<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99735
h@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:33036
ln/this.$get</</i.defer/n<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:34396


The following is the screenshot of the error in grafana that I'm gettng:
enter image description here



Any suggestions what I might be missing?



Note: I can see timer getting published on native prometheus using URL localhost:8080/prometheus.










share|improve this question



























    0















    I'm new to micrometer, prometheus and grafana. I'm trying to run my first example with these three things working together. But I'm having a hard time figuring out what I'm doing wrong.



    I'm using micrometer's API to create a PrometheusMeterRegistry like this:



    new PrometheusMeterRegistry(new PrometheusConfig() {
    @Override
    public Duration step() {
    return Duration.ofSeconds(10);
    }

    @Override
    @Nullable
    public String get(String k) {
    return null;
    }
    });


    And I'm creating a HttpServer as described here using the following code:



    try {
    HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
    server.createContext("/prometheus", httpExchange -> {
    String response = prometheusMeterRegistry.scrape();
    httpExchange.sendResponseHeaders(200, response.getBytes().length);
    try (OutputStream os = httpExchange.getResponseBody()) {
    os.write(response.getBytes());
    }
    });

    new Thread(server::start).start();
    } catch (IOException e) {
    throw new RuntimeException(e);
    }


    I configured Prometheus as my data-source in grafana and set the URL to http://localhost:8080/prometheus. But when I try creating a new dashboard and add a graph to it, I get a red exclamation mark saying t.data.data is undefined. And because of this I'm not able to view the graphs. The complete stack-trace is as follows:



    kr</t.prototype.transform@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:723420
    jr</t.prototype.query/</<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:736135
    qt@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:5239
    Wa@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:40274
    jr</t.prototype.query/<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:735858
    c/</<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92198
    c/<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92043
    $digest@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:97575
    $apply@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99590
    $applyAsync/r<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99735
    h@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:33036
    ln/this.$get</</i.defer/n<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:34396


    The following is the screenshot of the error in grafana that I'm gettng:
    enter image description here



    Any suggestions what I might be missing?



    Note: I can see timer getting published on native prometheus using URL localhost:8080/prometheus.










    share|improve this question

























      0












      0








      0








      I'm new to micrometer, prometheus and grafana. I'm trying to run my first example with these three things working together. But I'm having a hard time figuring out what I'm doing wrong.



      I'm using micrometer's API to create a PrometheusMeterRegistry like this:



      new PrometheusMeterRegistry(new PrometheusConfig() {
      @Override
      public Duration step() {
      return Duration.ofSeconds(10);
      }

      @Override
      @Nullable
      public String get(String k) {
      return null;
      }
      });


      And I'm creating a HttpServer as described here using the following code:



      try {
      HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
      server.createContext("/prometheus", httpExchange -> {
      String response = prometheusMeterRegistry.scrape();
      httpExchange.sendResponseHeaders(200, response.getBytes().length);
      try (OutputStream os = httpExchange.getResponseBody()) {
      os.write(response.getBytes());
      }
      });

      new Thread(server::start).start();
      } catch (IOException e) {
      throw new RuntimeException(e);
      }


      I configured Prometheus as my data-source in grafana and set the URL to http://localhost:8080/prometheus. But when I try creating a new dashboard and add a graph to it, I get a red exclamation mark saying t.data.data is undefined. And because of this I'm not able to view the graphs. The complete stack-trace is as follows:



      kr</t.prototype.transform@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:723420
      jr</t.prototype.query/</<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:736135
      qt@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:5239
      Wa@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:40274
      jr</t.prototype.query/<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:735858
      c/</<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92198
      c/<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92043
      $digest@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:97575
      $apply@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99590
      $applyAsync/r<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99735
      h@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:33036
      ln/this.$get</</i.defer/n<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:34396


      The following is the screenshot of the error in grafana that I'm gettng:
      enter image description here



      Any suggestions what I might be missing?



      Note: I can see timer getting published on native prometheus using URL localhost:8080/prometheus.










      share|improve this question














      I'm new to micrometer, prometheus and grafana. I'm trying to run my first example with these three things working together. But I'm having a hard time figuring out what I'm doing wrong.



      I'm using micrometer's API to create a PrometheusMeterRegistry like this:



      new PrometheusMeterRegistry(new PrometheusConfig() {
      @Override
      public Duration step() {
      return Duration.ofSeconds(10);
      }

      @Override
      @Nullable
      public String get(String k) {
      return null;
      }
      });


      And I'm creating a HttpServer as described here using the following code:



      try {
      HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
      server.createContext("/prometheus", httpExchange -> {
      String response = prometheusMeterRegistry.scrape();
      httpExchange.sendResponseHeaders(200, response.getBytes().length);
      try (OutputStream os = httpExchange.getResponseBody()) {
      os.write(response.getBytes());
      }
      });

      new Thread(server::start).start();
      } catch (IOException e) {
      throw new RuntimeException(e);
      }


      I configured Prometheus as my data-source in grafana and set the URL to http://localhost:8080/prometheus. But when I try creating a new dashboard and add a graph to it, I get a red exclamation mark saying t.data.data is undefined. And because of this I'm not able to view the graphs. The complete stack-trace is as follows:



      kr</t.prototype.transform@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:723420
      jr</t.prototype.query/</<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:736135
      qt@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:5239
      Wa@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:9:40274
      jr</t.prototype.query/<@http://localhost:3000/public/build/app.dfabdd44b3be44288eac.js:22:735858
      c/</<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92198
      c/<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:92043
      $digest@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:97575
      $apply@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99590
      $applyAsync/r<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:99735
      h@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:33036
      ln/this.$get</</i.defer/n<@http://localhost:3000/public/build/vendor.dfabdd44b3be44288eac.js:130:34396


      The following is the screenshot of the error in grafana that I'm gettng:
      enter image description here



      Any suggestions what I might be missing?



      Note: I can see timer getting published on native prometheus using URL localhost:8080/prometheus.







      java grafana metrics prometheus micrometer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 18:26









      Lavish KothariLavish Kothari

      870816




      870816
























          1 Answer
          1






          active

          oldest

          votes


















          2














          8080 is your application server. You need to run a Prometheus server that scrapes this application, then you can use localhost:9090 as a datasource.






          share|improve this answer
























          • This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

            – Lavish Kothari
            Jan 3 at 7:51












          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%2f54011331%2ft-data-data-is-undefined-in-grafana%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









          2














          8080 is your application server. You need to run a Prometheus server that scrapes this application, then you can use localhost:9090 as a datasource.






          share|improve this answer
























          • This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

            – Lavish Kothari
            Jan 3 at 7:51
















          2














          8080 is your application server. You need to run a Prometheus server that scrapes this application, then you can use localhost:9090 as a datasource.






          share|improve this answer
























          • This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

            – Lavish Kothari
            Jan 3 at 7:51














          2












          2








          2







          8080 is your application server. You need to run a Prometheus server that scrapes this application, then you can use localhost:9090 as a datasource.






          share|improve this answer













          8080 is your application server. You need to run a Prometheus server that scrapes this application, then you can use localhost:9090 as a datasource.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 21:03









          brian-brazilbrian-brazil

          15.6k13240




          15.6k13240













          • This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

            – Lavish Kothari
            Jan 3 at 7:51



















          • This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

            – Lavish Kothari
            Jan 3 at 7:51

















          This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

          – Lavish Kothari
          Jan 3 at 7:51





          This works perfectly, thanks. Can you please also tell me where, in prometheus, we can configure this localhost:9090 so that if I want to give a different host:port as data-source to grafana I can do that. I'm following this tutorial and starting my prometheus server using ./prometheus --config.file=prometheus.yml. It will be great if you can point me to the list of all the standard options. Thanks!

          – Lavish Kothari
          Jan 3 at 7:51




















          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%2f54011331%2ft-data-data-is-undefined-in-grafana%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

          MongoDB - Not Authorized To Execute Command

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

          How to fix TextFormField cause rebuild widget in Flutter