Skip to content

Support arithmetic operation in the value of @name tag #58

Description

@jerome89

In Graphite, it is not easy to add / subtract / multiply / divide a metric from another one. Graphite provides a lot of functions that enable users to have meaningful metrics, but it has its own limited usage to one single type of metric. Users have to generate a metric from different types of metrics by applying those arithmetic operations in non-intuitive way. Suppose we want to generate a new metric by applying summation on cpu_user and memory_usage. To do this, users have to use group() function to bundle two metrics together and use groupByTags on them to get desired result.

In Prometheus, it is done in quite intuitive way by querying with cpu_user + memory_usage. Prometheus automatically matches metrics having the same set of tags and make the desired result.

Currently users are now able to query metrics with tags, this can be achieved in limited sense but more intuitive way by supporting arithmetic operations in the value of @name tag. Users may generate the metric in the above by simply querying with seriesByTags('@name=cpu_user+memory_usage'), handling the query on the server by fetching metrics having @name=cpu_user, @name=memory_usage first then matching metrics having the same set of tags, and finally applying +operation on them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions