Code Monkey home page Code Monkey logo

metricsql's Issues

Support seting dynamic time duration

We want set dynamic time duration when generate recoding rules, support using variable during e.g.

  • with (a = 2h) (up{job="samples"}[a])
  • with (a = "2h") (up{job="samples"}[a])
  • with (hours = (day_of_month() - 1) * 24 + hour() + "h") (up{job="samples"}[hours])

related issue: dynamic time duration

Support remove label

When I use PushdownBinaryOpFilters
Example:
sum(rabbitmq_queue_messages_unacknowledged)
change to
sum(rabbitmq_queue_messages_unacknowledged{job=''rabbitmq-exporter})
But before PushdownBinartOpFilters,I want remove the label of job
Example:
sum(rabbitmq_queue_messages_unacknowledged{job=''rabbitmq-exporter})
change to
sum(rabbitmq_queue_messages_unacknowledged)
Does this feature currently support it? It's really useful !

WITH templates collision between names of variables and functions #2383

Describe the bug
When using WITH templates, users can define variables with custom names:

WITH(
now = sum(rate(my_metric_total)),
before = sum(rate(my_metric_total) offset 1h)
)
now/before*100

This expression will fail starting from v1.70 where new MetricsQL function now() was introduced.
But for versions below v1.70 the expression will be valid.

To Reproduce
See https://play.victoriametrics.com/promql/expand-with-exprs?query=WITH%28%0D%0Anow+%3D+sum%28rate%28my_metric_total%29%29%2C%0D%0Abefore+%3D+sum%28rate%28my_metric_total%29+offset+1h%29%0D%0A%29%0D%0Anow%2Fbefore*100&commit=Expand

Expected behavior
Local variable names should not conflict with function names. Otherwise, adding new function to MetricsQL will always have a chance to affect existing user queries.

cc @valyala

apply rule-based optimization

Some queries may be optmized by some rules to reduce latency and impove performance, such As

foo > 2 < 1     -> empty
sum(sum(sum(foo) by (a, b, c) by (a, b))) by (a)  -> sum(foo) by (a)

i is not equal to j

if i == j || i == len(s) {

	if s[i] == '.' {
		j := i
		i++
		for i < len(s) && isDecimalChar(s[i]) {
			i++
		}
		if i == j || i == len(s) {
			return -1
		}
	}

I'm learning MetricsQL and I've noticed that here 'i' might not be equal to 'j' because 'i' undergoes an addition operation. Should it be j+1 here?

DurationExpr support set operation

in application code, i want to convert metricql foo{} to foo{}[1d], but the RollupExpr's field (DurationExpr) has no update operation. can we support it in the near future.

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.