Skip to content

Commit

Permalink
fix(sdk-metrics): hand-roll MetricAdvice type as older API versions d…
Browse files Browse the repository at this point in the history
…o not include it (#4260)
  • Loading branch information
pichlermarc authored Nov 8, 2023
1 parent 73b4466 commit c7c1867
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
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

0 comments on commit c7c1867

Please sign in to comment.