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

fix(api): deprecate MetricAttributes and MetricAttributeValue #3406

Merged
merged 5 commits into from
Nov 16, 2022

Conversation

blumamir
Copy link
Member

@blumamir blumamir commented Nov 12, 2022

Just a small fix to the metrics API comment I spotted when reviewing open-telemetry/opentelemetry-js-contrib#1281

Probably it's a missed copy-paste mistake

deprecate MetricAttribute and MetricAttributeValue to align with SpanAttributes and SpanAttributeValue.

I wonder if it should also be replaced in the api package where it is used (I think yes)

@blumamir blumamir requested a review from a team November 12, 2022 07:20
@blumamir
Copy link
Member Author

blumamir commented Nov 12, 2022

Should this be added to changelog? feels to me it will just be noise

@codecov
Copy link

codecov bot commented Nov 12, 2022

Codecov Report

Merging #3406 (789fbbf) into main (bd56547) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 789fbbf differs from pull request most recent head 041f2a0. Consider uploading reports for the commit 041f2a0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3406      +/-   ##
==========================================
- Coverage   93.27%   93.26%   -0.02%     
==========================================
  Files         247      247              
  Lines        7348     7348              
  Branches     1512     1512              
==========================================
- Hits         6854     6853       -1     
- Misses        494      495       +1     
Impacted Files Coverage Δ
api/src/metrics/Metric.ts 100.00% <ø> (ø)
...emetry-core/src/platform/node/RandomIdGenerator.ts 87.50% <0.00%> (-6.25%) ⬇️

@blumamir
Copy link
Member Author

Actually, now I see that for trace API those types are deprecated.
I think it should be aligned in metrics too, right?

/**
 * @deprecated please use {@link Attributes}
 */
export type SpanAttributes = Attributes;

/**
 * @deprecated please use {@link AttributeValue}
 */
export type SpanAttributeValue = AttributeValue;

@blumamir blumamir changed the title docs: fix comment in metrics api refering to span fix(api): deprecate MetricsAttributes and MetricAttributeValue Nov 12, 2022
@blumamir blumamir changed the title fix(api): deprecate MetricsAttributes and MetricAttributeValue fix(api): deprecate MetricAttributes and MetricAttributeValue Nov 12, 2022
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to move away from either SpanAttributes or MetricAttributes in the API package and encourage implementations that depend on the newer API package to use the Attributes instead. These types are identical so there should be no breaking changes.

E.g.

  1. https:/open-telemetry/opentelemetry-js/blob/main/api/src/trace/span.ts#L53
  2. https:/open-telemetry/opentelemetry-js/blob/main/api/src/metrics/Metric.ts#L65

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can migrate to Attributes in all occurrences in the API package in a follow-up PR.

@dyladan dyladan merged commit e133f3f into open-telemetry:main Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants