Git Product home page Git Product logo

Comments (5)

hagen1778 avatar hagen1778 commented on June 2, 2024

Hi @ctaity

I'm not sure I understand the question. If you want to set resolution (a point per time interval) - take a look into Step and Resolution params. They are set automatically based on the current time-range and you can override them if it's needed.

from clickhouse-grafana.

hagen1778 avatar hagen1778 commented on June 2, 2024

Closing due to lack of activity

from clickhouse-grafana.

Akint avatar Akint commented on June 2, 2024

Maybe I can describe the need.
Grafana supports so-called Interval variables that represent a time span (eg. 1m, 1h, 1d).
I would like to be able to create such a variable with human-friendly values and to let user choose aggregation interval (to go from by-hour aggregation to by-day aggregation with a couple of mouse clicks). If auto option is chosen, the variable's value should be the same as of $interval variable.
Right now if I create a variable of type Interval, its value is used as-is: query SELECT intDiv(toUInt32(now()), $group_interval) * $group_interval * 1000 as t, 1 FROM system.one is generated into SELECT intDiv(toUInt32(now()), 1h) * 1h * 1000 as t, 1 FROM system.one and obviously fails with type mismatch error, and I want it to be generated into SELECT intDiv(toUInt32(now()), 3600) * 3600 * 1000 as t, 1 FROM system.one
image

from clickhouse-grafana.

Akint avatar Akint commented on June 2, 2024

@hagen1778, shouldn't this issue be reopened?

from clickhouse-grafana.

hagen1778 avatar hagen1778 commented on June 2, 2024

Hi @Akint

Thx for pinging me. I totally forgot about it)
I can suggest a workaround:

  1. Create a table intervals in CH (probably Log engine) with columns text and value
  2. Insert data like INSERT INTO intervals VALUES('1m', 60),('1h', 3600),('1d', 86400)
  3. Create a variable of type Query with CH as datasource.
  4. Set query as SELECT * FROM intervals
  5. Use variable as you mentioned before intDiv(toUInt32(now()), $group_interval) * $group_interval * 1000

from clickhouse-grafana.

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.