Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for VictoriaMetrics extensions #2

Open
vthriller opened this issue May 20, 2020 · 4 comments
Open

Support for VictoriaMetrics extensions #2

vthriller opened this issue May 20, 2020 · 4 comments

Comments

@vthriller
Copy link
Owner Author

In short, skipping all new functions that are of no interest to us:

  • aggr. op limits: sum(x) by (y) limit 10
    • why not expand that to vectors as well?
  • escape chars in vector and label names: foo\-bar{baz\=aa="b"}, f\x6f\x6f = foo
  • intervals measured in multiples of &step=s (think grafana's $__interval): rate(metric[10i] offset 5i)
  • fractional intervals: rate(node_network_receive_bytes_total[1.5m] offset 0.5d)
  • non-vector offsets: sum(foo) offset 24h
    • probably best to implement as a Node::Offset
    • funny that I sometimes wish I could stick ranges in arbitrary places, not offsets: avg_over_time(rate(foo [1m]) [5m])
  • negative offsets: q offset -1h
  • new operators: q1 default q2, q1 if q2, q1 ifnot q2
    • how hard would it be to allow arbitrary user-supplied operators?..
    • precedence, associativity?
  • trailing commas: m{foo="bar",}, f(a, b,), WITH (x=y,) x
  • string literal concatenation (useful in WITH stmts): {__name__=commonPrefix+"suffix1"}
  • comments: up # this is a comment

WITH templates:

# Calculate network utilization
WITH (
    maxRate = 1e9 / 8, # Gigabit network
    commonFilters = {instance=~"$node:$port",job=~"$job"},
    networkUtilization(bytesTotal, maxRate) = ru(maxRate - rate(bytesTotal{commonFilters}[5m]), maxRate)
) networkUtilization(node_network_receive_bytes_total, maxRate)
WITH (
    f(a, b) = WITH (
        f1(x) = b-x,
        f2(x) = x+x
    ) f1(a)*f2(b)
) f(foo, with(x=bar) x)

@vthriller
Copy link
Owner Author

funny that I sometimes wish I could stick ranges in arbitrary places

Turns out subqueries are now a thing

@vthriller
Copy link
Owner Author

Comments are also supported by Prometheus 2.14 (#3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant