autometrics-ts: supporting different metrics collection libraries (and exemplars) #34
Replies: 2 comments 1 reply
-
I'd put in a vote for separate packages. It doesn't make sense to me to include both dependencies when you're only ever going to use one. |
Beta Was this translation helpful? Give feedback.
-
My worry with splitting the packages up into Come to think of it, if we do want to split things up, maybe it would be good to make it explicit and have an |
Beta Was this translation helpful? Give feedback.
-
Unlike other libraries,
autometrics-ts
currently only supports one underlying metrics collection library: the official OpenTelemetry metrics SDK.I'm exploring options how to add support for different underlying metrics collection libraries. The main reasons for this are:
Autometrics should work with whatever setup you may already be using to produce metrics;
Exemplars support (#57) is currently blocked by the fact that the official OpenTelemetry client doesn't itself have support exemplars. Supporting a more mature Node.js specific
prom-client
would allow supporting exemplars in the TypeScript library as well.In the Rust version of Autometrics, the underlying libraries are configured using the
--features
flag, however, of course no such thing exists in the TS/JS world. There are two main ways I'm currently weighing to enable this interface:Separate
autometrics
packages for each underlying metrics library. This means:@autometrics/autometrics-open-telemetry
,@autometrics/autometrics-prom-client
each of which the user would be able to install separately. If the user doesn't care about this and just wants to start with autometrics they can always pick the default packagenpm i autometrics
which would just run OpenTelemetry under the hood.Set underlying metrics collection libraries at runtime using an environment variable. So in order to run Autometrics with
prom-client
you would runAUTOMETRICS_ENV=prom-client node server.js
. If no environment variable is set, the program would run with the default OpenTelemetry package.Between the two I'm currently firmly on the fence, so I'd love to get community's input before moving with either.
Beta Was this translation helpful? Give feedback.
All reactions