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(sdk-metrics): hand-roll MetricAdvice type as older API versions do not include it #4260

Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

fix(sdk-metrics): hand-roll MetricAdvice type as older API versions do not include it #4260

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
18 changes: 11 additions & 7 deletions packages/sdk-metrics/src/InstrumentDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
* limitations under the License.
*/

import {
MetricAdvice,
MetricOptions,
ValueType,
diag,
} from '@opentelemetry/api';
import { MetricOptions, ValueType, diag } from '@opentelemetry/api';
import { View } from './view/View';
import { equalsCaseInsensitive } from './utils';

Expand Down Expand Up @@ -49,8 +44,17 @@ export interface InstrumentDescriptor {
readonly valueType: ValueType;
/**
* @experimental
*
* This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.7.0 and up.
* In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround.
*/
readonly advice: MetricAdvice;
readonly advice: {
/**
* Hint the explicit bucket boundaries for SDK if the metric has been
* aggregated with a HistogramAggregator.
*/
explicitBucketBoundaries?: number[];
};
}

export function createInstrumentDescriptor(
Expand Down