Git Product home page Git Product logo

druid-grafana's Introduction

Druid as a Data Source for Grafana

Table of Contents

What is this Druid-Grafana plugin?

Grafana doesn't supports Druid as a Data Source, this plugin aims to do so.

Features

At the time of writing, the plugin supports all Grafana features and all Druid queries:

  • Druid queries: SQL, timeseries, topn, groupby, timeboundary, segmentmetadata, datasourcemetadata, scan, search, JSON
  • Variables: Grafana global variables replacement, query variables, formatter druid:json (provide support for multi-value variables within rune queries).
  • Alerts
  • Explore
  • Logs

if you're using a self-signed TLS certificate, an option to "Skip TLS verify" will be shown when "https" is used in datasource URI)

Screenshots

Datasource - Connection

Datasource - connection

Datasource - Default settings

Datasource - default settings

Panels

Panels

Query builder - JSON

Query builder - JSON

Query builder - SQL

Query builder - SQL

Query builder - Timeseries

Query builder - timeseries

Query builder - Settings

Query builder - settings

Variables

Variables

Variables - Formatter - druid:json

Variables - formatter - druid:json

Explore - Logs

Explore - logs

Query builder - Settings - Logs

Query builder - settings - logs

Contribute

Any contribution is welcome! Feel free to join on Slack to discuss :) To go further, see Contribute

Install

  • From Grafana.com: grafana-cli plugins install grafadruid-druid-datasource $VERSION
    • If $VERSION is not specified latest version will be installed
  • From remote archive: grafana-cli --pluginUrl https://github.com/grafadruid/druid-grafana/releases/download/v$VERSION/grafadruid-druid-datasource-$VERSION.zip plugins install grafadruid-druid-datasource
  • From local archive: unzip grafadruid-druid-datasource-$VERSION.zip -d $YOUR_PLUGIN_DIR

Where $VERSION is for instance 1.0.0 and $YOUR_PLUGIN_DIR is for instance /var/lib/grafana/plugins

(Source: https://grafana.com/docs/grafana/latest/plugins/installation/)

Examples

You can try out various advanced features of the plugin by importing the demo dashboard and running it against the Wikipedia dataset used in the Druid quickstart tutorial.

When using the provided docker based environment (./mage env:start && ./mage), the dataset is automatically ingested in Druid, the datasource and dashboard are automatically provisionned in Grafana.

druid-grafana's People

Contributors

ahuret avatar apoorvguptaai avatar dependabot[bot] avatar gkze avatar gworley3 avatar jbguerraz avatar jbonofre avatar koskinpark avatar kwapik avatar m-ghazanfar avatar mickymiek avatar raakasf avatar saketbairoliya2 avatar san-san avatar williamroynelson avatar wonderino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

druid-grafana's Issues

facing issue on grafana 7.3 while adding data source

while adding the plugin getting following exception:

Unexpected token '<' Evaluating https://quanta.goshd.com/public/plugins/grafadruid-druid-datasource/module.js Loading plugins/grafadruid-druid-datasource/module

Screenshot 2021-01-19 at 12 49 03 PM

Query inspector displays binary data instead of JSON

The query inspector doesn't display response from Druid as JSON instead just a binary blob:

Screen Shot 2021-02-25 at 12 08 34 PM

It is really helpful for users to be able to see JSON response in order to figure out what/if anything is wrong with their queries.

go-druid: intervals spec

grafadruid/go-druid@8186874 brings structured intervals spec instead of the shorthand "intervals": ["start/end"], it allows for copy/paste converted sql queries to native queries from druid web console for instance. it's so a better structure.
need to update the intervals component accordingly before updating go-druid dependency.

Support skip TLS verification

Most plugins let you skip TLS verification, though not recommended, this might be helpful in some scenarios. Changes needed in frontend, backend and go-druid

Skip_tls_verification

Response rows limit

What ?

Add an option to configure the response rows limit.

Why ?

I got a use case where the grafana panel is a map, and too much points on this map can make the laptop crash.
I can set LIMIT in the sql request but then we'll won't be notice the response is limited, imo, having a message that explain limit is a good ux feature.

How ?

It could be a numeric field in "Settings" -> "Response options" container just after "Hide empty columns".
Default to 0 means no limit.
If the limit is exceeded, then it returns the limited response + an error at grafana response level.

image

bug: query settings don't show values of datasource default query settings

In the Druid datasource configuration you can specify default query settings.

These are respected but the set values don't show in the query settings pane when you are running queries.

Steps to reproduce:

  1. Set a query setting in the datasource config. For example I set the format to log and the hide empty columns to on.
  2. Go to the explore tab and perform a query.
  3. See that the settings are used. In my example, I get back log formatted results with empty columns hidden.
  4. Pop out the query settings. See that they don't show the defaults set at the datasource level.

prepareResponse - appenders

Implement probably some method that returns a container (make([]whattypeever, 0)) and its related appender func based on column type)

filter out empty columns

Add an option to filter out empty columns. Should require adding an option to control whether this is turned on and modifications to prepareResponse to filter out the empty columns.

Receive an error when create an alter

What happened:

When I was trying to create an alter and test rules, there seemed to be a bug. The request and response is as below.

  "firing": true,
  "state": "pending",
  "conditionEvals": " = true",
  "timeMs": "179.965ms",
  "error": "tsdb.HandleRequest() response error &{POST http://proxy.druid.ke.com/druid/v2 giving up after 6 attempt(s) POST http://proxy.druid.ke.com/druid/v2 giving up after 6 attempt(s) A <nil> [] [] 0xc001913e30}",
  "logs": [
    {
      "message": "Condition[0]: Query",
      "data": {
        "from": 1622531328676,
        "queries": [
          {
            "refId": "A",
            "model": {
              "builder": {
                "aggregations": [
                  {
                    "name": "all_cnt",
                    "type": "count"
                  }
                ],
                "dataSource": {
                  "name": "commerce_adx_digv_empty_log",
                  "type": "table"
                },
                "filter": {
                  "dimension": "ip",
                  "type": "selector",
                  "value": "10.26.12.246"
                },
                "granularity": "minute",
                "intervals": {
                  "intervals": [
                    "${__from:date:iso}/${__to:date:iso}"
                  ],
                  "type": "intervals"
                },
                "postAggregations": [],
                "queryType": "timeseries",
                "virtualColumns": []
              },
              "expr": "{\"builder\":{\"queryType\":\"timeseries\",\"dataSource\":{\"name\":\"commerce_adx_digv_empty_log\",\"type\":\"table\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"${__from:date:iso}/${__to:date:iso}\"]},\"granularity\":\"minute\",\"filter\":{\"dimension\":\"ip\",\"type\":\"selector\",\"value\":\"10.26.12.246\"},\"aggregations\":[{\"name\":\"all_cnt\",\"type\":\"count\"}],\"postAggregations\":[],\"virtualColumns\":[]},\"settings\":{}}",
              "hide": true,
              "refId": "A",
              "settings": {}
            },
            "datasource": {
              "id": 18,
              "name": "Druid-server-alert"
            },
            "maxDataPoints": 0,
            "intervalMs": 0
          }
        ],
        "to": 1622531628676
      }
    }
  ]
}

As you can see, the parameter "intervals" seems not work properly. At lease, I think, It should not be something like "${__from:date:iso}/${__to:date:iso}".

However, When I specified a certain time range like the pic below, the problem was solved.
image

What you expected to happen:
The alter works successfully without specifying the intervals.

For an instance, when I use official grafana-prometheus. The request of an alter is like this:
image
The interval is "" (nothing here, only "from/to" specify the time range )

How to reproduce it:
Build an timeseries query without specifying the intervals. Then, create an alter and test rule. The error message will come out.

Environment:

  • Grafana version: v7.3.5
  • Data source type: druid
  • OS Grafana is installed on: Linux
  • User OS & Browser: Chrome

executeQuery - processors

Probably need to extract per-query preprocessor and postprocessor into a per-query file.
Load those "plugins" (ak. QueryProcessor ?) into a register and then do something like plugins[q.Type()].preprocess(q) and plugins[q.Type()].postprocess(r) ?

Variables - Multivalues

Provide a way to use a multi-values variables within a rune query.
Ideally making it possible to merge with static options, like:
image
So ["${countries:druidmultiple}", "France"] would expand into something like ["USA", "Italy", "France"]

Can we display Metadata Information Instead of Keying in Query

Hello,

Can we use druid metadata information like Datasource name, metric name and dimension name as drop down for forming the query instead of keying in all these information through UI. There are many chances user may have many numer of datasources/metrics or dimension which needs to be selected while generating dashboard.

Thanks,
Akhilesh

Using Variables in Aggregation and Dimension

Hi,

Is there a way currently we can define variables for creating multiple aggregations and dimension. Based on the variables selected need to build multiple aggregation and dimensions. Tried using "${Variable:druid:json}" but it doesnt add multiple aggregations nor dimensions. This is for query builder. Please let me know of there are any work around for this.

Regards,
Akhilesh

Some error happen in use this plugin

grafana version: V7.0.3
plugin version: V1.0.3(V1.0.2ใ€V1.0.1ใ€V1.0.0)
when i unzip this plugin in data/plugin , and restart grafana
the log show msg="Failed to load plugin" logger=plugins error="plugin \"grafadruid-druid-datasource\" is unsigned"
show i add allow_loading_unsigned_plugins=grafadruid-druid-datasource in configure
but when i use this plugin ,there are some error happen
image
maybe it's a frontEnd Error
please help me or give me some advise

Graph / dashboard examples

Trying to play around with this as we've been longing for Druid support in Grafana for what feels like ages. Thanks for building this great plugin and putting it out there.

While I was able to put together some basic metrics displays (e.g. simple queries for singular metrics) I was struggling with and failed to build some more complex graphs e.g. referencing global variables and such. I assume they would be supported after studying the readme.

Of course having a proper tutorial would make sense in the long run. For the moment even seeing some screenshots of possible graph configurations/query types/advanced usage examples like variables and formulas along with the results would help kickstart everyone and provide a starting point from which to build upon. I assume the people using your plugin at the moment are probably advanced Grafana users to say the least so this can go a long way.

help to create a group by querie

Hello, we used to use the first druid plugin for Grafana (https://github.com/societe-generale/druidplugin ) and as you can see when we do a group by (or topn) query , Druid give us 2 metrics : one for each series

image

When we try do to the same with your plugin, the asnwer is only one metric instead of 2, when we used the graph panel. We don't understand why because when we do the same query with a table panel panel, we can see all the data. For example :

image

image

image

image

image

Best regards.

Components - Required fields

At the moment no field is required on client side, no validation at all.
Would be great to, at least, add required validation.

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.