docs(develop): Loosen metrics SDK spec for modules#17389
docs(develop): Loosen metrics SDK spec for modules#17389szokeasaurusrex wants to merge 2 commits intomasterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Updated the terminology for function naming conventions in the metrics documentation.
There was a problem hiding this comment.
We still should expose metrics_gauge etc. functions, you can add additional macros as you see fit. Only exposing macros on a hot path won't scale fwiw, so these functions are still mandatory.
I'm also confused with what you stated about logs in Rust, are our docs wrong? https://docs.sentry.io/platforms/rust/logs/#best-practices
|
@cleptric Sounds good, I will also add the functions to the Rust SDK. Regarding the following:
Yes, the docs are very wrong. None of the examples in that section compile, and I have opened #17393 to delete the section for now. More context on that PR. |
| <SpecSection id="metrics-module" status="stable" since="2.0.0"> | ||
|
|
||
| ### Metrics Module | ||
| ### Metrics Capturing Functionality |
There was a problem hiding this comment.
| ### Metrics Capturing Functionality | |
| ### Metrics Capture Functionality |
| SDKs **MUST** expose metrics methods in a `metrics` module or namespace. At minimum, the SDK **MUST** implement the following methods: | ||
| SDKs **MUST** expose functionality for capturing `count`, `gauge`, and `distribution` metrics. | ||
|
|
||
| Metrics-capturing functionality **SHOULD** be exposed as functions (or another suitable language construct) in a `metrics` module or namespace. If exposing the functionality in a module or namespace is infeasible in a particular SDK's language, the function names **SHOULD** be prefixed with the word `metric`. |
There was a problem hiding this comment.
| Metrics-capturing functionality **SHOULD** be exposed as functions (or another suitable language construct) in a `metrics` module or namespace. If exposing the functionality in a module or namespace is infeasible in a particular SDK's language, the function names **SHOULD** be prefixed with the word `metric`. | |
| Metrics capture functionality **SHOULD** be exposed as functions (or another suitable language construct) in a `metrics` module or namespace. If exposing the functionality in a module or namespace is infeasible in a particular SDK's language, the function names **SHOULD** be prefixed with the word `metric`. |
The "metrics module" section in the "metrics" develop spec is too restrictive.
In Rust, for example, we can implement a more ergonomic API by using macros instead of methods. Due to language restrictions, it is not possible to define macros in a module, only in the top-level of the crate, so we use
metric_count!,metric_guage!andmetric_distribution!instead. This API aligns with what we already do for logs in the Rust SDK.Therefore, I propose loosening the requirements. The only "MUST"-level requirement in my proposal would be to expose this functionality; the precise API is lowered to "SHOULD"-level requirements to allow SDKs to deviate where this would be beneficial.