Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Add isNonNull function #959

Closed
wants to merge 6 commits into from
Closed

Conversation

stivenbb
Copy link
Contributor

@stivenbb stivenbb commented Jul 9, 2018

Implementation of isNonNull() graphite function.

Takes a seriesList and counts up non-null values. Returns a seriesList where 1 is specified for non-null values, and 0 is specified for null values.

Copy link
Collaborator

@shanson7 shanson7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did an internal review of this implementation already. It has been running on our production cluster for a couple days and is quite an improvement in speed.

---------- Native Implementation ----------
Requests      [total, rate]            1200, 10.01
Duration      [total, attack, wait]    1m59.929790104s, 1m59.899999891s, 29.790213ms
Latencies     [mean, 50, 95, 99, max]  29.710889ms, 25.292608ms, 42.891724ms, 124.23679ms, 530.666495ms
Bytes In      [total, mean]            13865883, 11554.90
Bytes Out     [total, mean]            0, 0.00
Success       [ratio]                  100.00%
Status Codes  [code:count]             200:1200
Error Set:

---------- Graphite (Python) Implementation ----------
Requests      [total, rate]            1200, 10.01
Duration      [total, attack, wait]    2m0.256803282s, 1m59.899999886s, 356.803396ms
Latencies     [mean, 50, 95, 99, max]  183.917679ms, 109.067328ms, 559.073411ms, 792.026173ms, 1.12680363s
Bytes In      [total, mean]            33578816, 27982.35
Bytes Out     [total, mean]            0, 0.00
Success       [ratio]                  100.00%
Status Codes  [code:count]             200:1200
Error Set:

On average, the native implementation was 6x faster, median was 4x faster, p95 was 13x faster, p99 was 6x faster and max was over 2x faster


out := make([]models.Series, 0, len(series))
for _, serie := range series {
transformed := models.Series{
Copy link
Contributor

@replay replay Jul 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the out slice is already allocated with the correct size. wouldn't it be better to just update its properties instead of instantiating a new models.Series and then copying it into out?
f.e.:

transformed := &out[i]
transformed.Target = fmt.Sprintf("isNonNull(%s)", serie.Target)

(i is the iterator of the loop)

Copy link
Contributor

@replay replay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with one suggestion

@stivenbb
Copy link
Contributor Author

Added requested change

@replay
Copy link
Contributor

replay commented Jul 16, 2018

GitHub seems to be broken right now. I clicked the "Merge" button which ended up in an error page. Looking at the master branch it seems the PR got merged but this PR page did not get updated accordingly.

@stivenbb
Copy link
Contributor Author

@replay mind trying again to accordingly update the PR page?

@replay
Copy link
Contributor

replay commented Jul 19, 2018

@stivenbb I'm afraid I'll only be able to just close this PR. As the commits are merged already, I guess that shouldn't make a difference:
screenshot from 2018-07-19 16-27-54

@shanson7
Copy link
Collaborator

I see the commits in there, and @stivenbb gets credit as a contributor :)

I think closing this is fine.

@shanson7 shanson7 closed this Jul 19, 2018
stivenbb pushed a commit to bloomberg/metrictank that referenced this pull request Jul 25, 2018
@shanson7 shanson7 deleted the isNonNull branch August 21, 2018 20:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants