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

RFC: Typed Metric Interfaces #14

Closed
jaredcnance opened this issue Dec 9, 2019 · 0 comments
Closed

RFC: Typed Metric Interfaces #14

jaredcnance opened this issue Dec 9, 2019 · 0 comments

Comments

@jaredcnance
Copy link
Member

jaredcnance commented Dec 9, 2019

Counters

Expose 3 methods for publishing counters.

metrics.increment('Increment');
metrics.decrement('Decrement');
metrics.count('Count', 10);
{ "Increment": 1, "Decrement": -1, "Count": 10 }

Multiple calls to the same key will be recorded as separate entries. This allows us to preserve the sample count.

metrics.increment('Key');
metrics.increment('Key');
metrics.decrement('Key');
{ "Key": [ 1, 1, -1 ] }

Alternatively, we can use the PMD syntax:

{ 
  "Key": {
      "type": "dist",
      "buckets": "explicit",
      "values": [ 1, -1 ],
      "counts": [ 2, 1 ] 
}

Gauges

metrics.gauge('key', 10);

Timers

metrics.time('key', 10);
timedMetricScope('operation', metrics => {
   // do things and track how long it takes...
})

Histograms: TBD

metrics.histo('key', 10);
{ 
  "Key": {
    "type": "dist",
    "buckets": "explicit",
    "values": [ 1 ],
    "counts": [ 10 ]
  } 
}
@jaredcnance jaredcnance changed the title Typed Metric Interfaces RFC: Typed Metric Interfaces Mar 9, 2020
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