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

[Feature]: PartialEq support for AnyValue #1401

Closed
psandana opened this issue Nov 24, 2023 · 1 comment
Closed

[Feature]: PartialEq support for AnyValue #1401

psandana opened this issue Nov 24, 2023 · 1 comment
Labels
enhancement New feature or request triage:todo Needs to be traiged.

Comments

@psandana
Copy link
Contributor

psandana commented Nov 24, 2023

Related Problems?

The strtuct opentelemetry::logs::LogRecord has a member called attributes that is of type Option<Vec<(Key, AnyValue)>>.

Key is coming from opentelemetry::common::Key and it is already deriving from PartialEq and Eq. But AnyValue is not.

This makes comparisons not possible among two Option<Vec<(Key, AnyValue)>> or Vec<(Key, AnyValue)>. This is not ergonomic, as for simple unit testing of exporters/providers has to be done by hand-written iterations and custom comparisons.

This is valid for any scenario where an AnyValue is likely to be compared against another.

Describe the solution you'd like:

In here:
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/src/logs/record.rs#L78

Change this:

/// Value types for representing arbitrary values in a log record.
#[derive(Debug, Clone)]
pub enum AnyValue {

By this:

/// Value types for representing arbitrary values in a log record.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyValue {

Considered Alternatives

No response

Additional Context

AnyValue cannot derive from Eq, as f64 has not support for it.

@psandana psandana added enhancement New feature or request triage:todo Needs to be traiged. labels Nov 24, 2023
@psandana
Copy link
Contributor Author

Fixed by #1415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage:todo Needs to be traiged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant