[SMT-0003] Propose portable metric descriptions #245
Could you add the full API diff listing with the doc comments here?
How about using metricDescription instead? Having .description breaks CustomStringConvertible conformance. While there are no existing users who could've added this conformance yet, it prevents from doing one in the future. And MetricDescriptor looks like a good candidate for such a conformance.
Could add code examples using new APIs in the Proposed solution section?
registry API that takes `help:`, and `swift-otel` packs the description into a
`label:dimensions:` ones. Each new requirement provides a default implementation that
- **`MultiplexMetricsHandler`** forwards the descriptor to every underlying factory.
In the final version of the proposal this section should not be present.
The implementation is already linked in the proposal header, no need for this section.
Should match the property holding it and I have concerns about .description.
How would it move, would it require a new structure specifically for Recorder?
@kukushechkin ,
Updated — renamed to metricDescription, added the full API diff and an example, removed the Open questions section. For aggregate: kept it as a separate parameter on makeRecorder(descriptor:aggregate:) rather than folding it into MetricDescriptor, since it only applies to Recorder — happy to reconsider if you'd rather see it moved.
I believe the PoC hasn't been updated with metricDescription change.
No need for the implementation here, just the API. Here and below.
No need for this section at all.
Yet another unnecessary reference to the PoC.
kukushechkin
ManjunathAnawal
Propose SMT-0003: Portable metric descriptions via
MetricDescriptorProposal: SMT-0003
Author(s): Manjunath Anawal ([@ManjunathAnawal](https://github.com/ManjunathAnawal))
Status: Draft (pre-review)
Implementation: [apple/swift-metrics#239](https://github.com/apple/swift-metrics/pull/239) (proof of concept, draft PR)
SMT-0003slot and was closed without merging; this proposal reuses the number with maintainer agreement.Motivation:
Swift Metrics currently passes only a label and dimensions to backends, so there
is no portable way to express a Prometheus/OpenMetrics HELP line or an OTLP
instrument description. Relates to #236. Reuses the SMT-0003 slot from #237,
which was closed without merging.
Modifications:
Added the proposal document at
Sources/CoreMetrics/Docs.docc/Proposals/SMT-0003-metric-descriptors.md — see that
file for the full Summary, Design, Compatibility, and Alternatives sections.
A proof-of-concept implementation is linked as draft PR #239.
Result:
Reviewers can discuss the design here before it goes to public review on
forums.swift.org.