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

Improve .metric() API #75

Closed
jamischarles opened this issue Mar 28, 2023 · 1 comment
Closed

Improve .metric() API #75

jamischarles opened this issue Mar 28, 2023 · 1 comment

Comments

@jamischarles
Copy link
Contributor

The .metric() API feels very awkward atm.

https://github.com/krakenjs/beaver-logger/blob/main/src/logger.js#L291-L304

Currently it's:

function metric(metricPayload: Metric){}

Which requires a .name property for the metric name.

I'm torn on how low-level to make this but maybe having a rawMetric(payload) and another method makes sense.

So it'd be

.rawMetric(payload);

.metric(eventName, namespace, dimensions);

.metric("weasley.flow.started", "pp.xo.weasley.custom", {
  app: 'weasley',
  isWPS: false,
  country: 'US',
  currencyCode: 'USD',
  releaseHash: 'e1fnrnd'
})

Then in sfx this would show up under the pp.xo.weasley.custom metric, with the event_name dimension set to weasley.flow.started

Maybe something like this. Still kind of torn on this, but wanted to raise it up. @westeezy

@jamischarles
Copy link
Contributor Author

Nevermind. Forgot that this needs to be generic and backend agnostic.

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