graphite-web icon indicating copy to clipboard operation
graphite-web copied to clipboard

[feature request] asPercent taking two series lists

Open mleinart opened this issue 13 years ago • 15 comments

Imported from https://bugs.launchpad.net/bugs/1005366

Reported by harisuthan
Date Created May 28, 2012

Originial Desc: I have a use case where I need to find the percentage between two series lists like:

asPercent(groupByNode(serieslist1, x, "sumSeries"), groupByNode(serieslist2, y, "sumSeries"))

Is there way to achieve this? If not and if you find this useful may I request a feature addition where, when two series lists with "equal length" are passed as parameters to asPercent, it will return a serieslist with the same length where each series is a percentage of the individual input series?

Michael's Response: I think asPercent and divideSeries could probably support this - rather than the 2nd series being required to have a length of 1, it could be required to have either: a length of 1 (current behavior) or a length equal to the 1st series (your proposed behavior).

Unfortunately I cant spot a way to do this without having to enumerate every series out.

If you'd like the new feature to be explored, convert this question to a bug report and mark it as a feature request so that it can be tracked.

mleinart avatar Mar 13 '13 06:03 mleinart

Comment by tewner on Jun 11, 2012:

I have a similar request with "divideSeries" - I want to specify a wildcard list of hosts and divide two metrics from each host - I still would love to use the coolest feature of Graphite - I want new plots for new hosts as the hosts are created.

cactiStyle( alias( divideSeries( perSecond( servers.Server1.com_application_GatewayStats.TotalParsingTime ), perSecond( servers.Server1.com_application_GatewayStats.CallsCount ) ) ,"Server1 - TotalParsingTime per Req" ) )

mleinart avatar Mar 13 '13 06:03 mleinart

Comment by tewner on Jun 11, 2012:

Small difference with my situation is that because I want to use wildcards, I need the 2 series' matched by host, and not by position in the series. Group-by index in the NODE name (likegroupByNode) SHOULD be ok, though.

mleinart avatar Mar 13 '13 06:03 mleinart

+1 from me for this feature

:heart:

Does this rely on any other PRs?

pcn avatar Dec 23 '13 17:12 pcn

No, it works as is :)

Does this rely on any other PRs?

Nope :)

Status here?

corradio avatar Dec 01 '14 13:12 corradio

Not very good as I see - https://github.com/graphite-project/graphite-web/pull/551 needs to be rebased and tests need to be added (IIRC no function changes w/o testing accepted).

deniszh avatar Dec 01 '14 13:12 deniszh

Is there another workaround right now?

corradio avatar Dec 01 '14 13:12 corradio

Sorry, I didn't have the take to get into this again (I'm not regularly working with this so I will have to dive into graphite again to rebase and add tests, so it might not happen very soon :-/ ).

looking forward to this feature! :)

jemshad avatar Feb 18 '16 06:02 jemshad

asPercent now supports multiple divisor series in the total parameter, or you can pass the results of sumSeries(seriesList). Closing this one.

obfuscurity avatar Jul 28 '16 19:07 obfuscurity

Thanks @obfuscurity, asPercent works great. But the original issue description and subsequent comments also included divideSeries, but it looks like only asPercent was actually addressed? I looked but failed to find a separate issue for divideSeries. Would it make sense to create one or reopen this?

eyablonowitz avatar Jul 29 '16 17:07 eyablonowitz

@ericy-jana Correct. Can you elaborate on a user case not covered by the asPercent() enhancements?

obfuscurity avatar Jul 29 '16 17:07 obfuscurity

@obfuscurity I am trying to graph I/O latency from stats fed to Graphite by a Sensu check reading /proc/diskstats (https://github.com/sensu-plugins/sensu-plugins-disk-checks/blob/master/bin/metrics-disk.rb).

I am trying to divide the time spent doing I/O over the sample period by the number of I/O operations during the same time period. This works ok if I am graphing a single host, but fails when using variables/wildcards to attempt to graph multiple hosts. This same pattern used to fail in a similar way with asPercent prior to .10 but now works great (e.g. for graphing CPU utilization %).

Below is the targets array from the Grafana panel json to further illustrate what I am trying to do. Apologies if I am missing an obvious solution. I am new to Graphite.

Edit - After typing this up a colleague made the suggestion that I could just use the asPercent function and scale it by 0.01 which works fine.

  "targets": [
    {
      "target": "nonNegativeDerivative(linux.io.$cluster.$host.*.ioTime)",
      "hide": true
    },
    {
      "target": "groupByNodes(#A, 'sum', 2,3)",
      "textEditor": true,
      "hide": false
    },
    {
      "target": "nonNegativeDerivative(linux.io.$cluster.$host.*.{reads,writes})",
      "hide": true
    },
    {
      "target": "groupByNodes(#C, 'sum', 2,3)",
      "textEditor": true,
      "hide": false
    },
    {
      "target": "divideSeries(#B,#D)",
      "hide": false,
      "textEditor": true
    }
  ],

eyablonowitz avatar Jul 29 '16 17:07 eyablonowitz