Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added

- Added `encoding::text::encode_descriptor` and `encoding::text::encode_metric`
for custom registries that need to compose descriptors, samples and EOF
markers independently.
- Added `EncodeMetric` forwarding for `Arc<T: EncodeMetric>`.

## [0.24.1]

### Added
Expand Down
18 changes: 18 additions & 0 deletions src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ impl EncodeMetric for Box<dyn EncodeMetric> {
fn metric_type(&self) -> MetricType {
self.deref().metric_type()
}

fn is_empty(&self) -> bool {
self.deref().is_empty()
}
}

impl<T: EncodeMetric + ?Sized> EncodeMetric for Arc<T> {
fn encode(&self, encoder: MetricEncoder) -> Result<(), std::fmt::Error> {
self.deref().encode(encoder)
}

fn metric_type(&self) -> MetricType {
self.deref().metric_type()
}

fn is_empty(&self) -> bool {
self.deref().is_empty()
}
}

/// Encoder for a Metric Descriptor.
Expand Down
Loading