Coder Social home page Coder Social logo

Comments (6)

knoguchi avatar knoguchi commented on August 21, 2024

Here is a quick hack to apply the template variable on groupBy field.

diff --git a/src/datasource.js b/src/datasource.js
index a79c8fc..7b7991e 100644
--- a/src/datasource.js
+++ b/src/datasource.js
@@ -115,7 +115,7 @@ function (angular, _, dateMath, moment) {
       var filters = target.filters;
       var aggregators = target.aggregators;
       var postAggregators = target.postAggregators;
-      var groupBy = target.groupBy;
+      var groupBy = _.map(target.groupBy, (e) => { return templateSrv.replace(e) });
       var limitSpec = null;
       var metricNames = getMetricNames(aggregators, postAggregators);
       var intervals = getQueryIntervals(from, to);

from druidplugin.

CarsonCao avatar CarsonCao commented on August 21, 2024

@knoguchi Thank you for your solution. I modified the code according to your way on dimension field, but it did not work. What should I do?

from druidplugin.

knoguchi avatar knoguchi commented on August 21, 2024

from druidplugin.

CarsonCao avatar CarsonCao commented on August 21, 2024

@knoguchi I know that. It works for GroupBy.But it don't work in TopN.

from druidplugin.

knoguchi avatar knoguchi commented on August 21, 2024

You didn't even mention TopN besides the JSON. I hoped you'd get the idea as to how the template variables work in Grafana. It's easy to apply the same fix for other fields.

Created a PR #16.

from druidplugin.

amoussoubaruch avatar amoussoubaruch commented on August 21, 2024

hi @CarsonCao

I'm just starting using grafana and druid. How can you create template variable. I do not find any documentation for that.
Can you please send my a link or any exemple can help me to advance.

Thanks

from druidplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.