From dc44b8611bb1052a91c3f48922522618e4cf1c1e Mon Sep 17 00:00:00 2001 From: Amir Blum Date: Sat, 30 Apr 2022 12:43:50 +0300 Subject: [PATCH] fix(resources): extend ResourceAttributes interface to comply with spec (#2924) Co-authored-by: Valentin Marchaud --- CHANGELOG.md | 1 + packages/opentelemetry-resources/src/types.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2c6e27cc1..523099cf3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file. * fix: sanitize attributes inputs [#2881](https://github.com/open-telemetry/opentelemetry-js/pull/2881) @legendecas * fix: support earlier API versions [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan * fix: support extract one digit '0' in jaeger traceFlag [#2905](https://github.com/open-telemetry/opentelemetry-js/issues/2905) @shmilyoo +* fix(resources): extend ResourceAttributes interface to comply with spec [#2924](https://github.com/open-telemetry/opentelemetry-js/pull/2924) @blumamir ### :books: (Refine Doc) diff --git a/packages/opentelemetry-resources/src/types.ts b/packages/opentelemetry-resources/src/types.ts index 94d5e4b892..717f71381d 100644 --- a/packages/opentelemetry-resources/src/types.ts +++ b/packages/opentelemetry-resources/src/types.ts @@ -16,11 +16,14 @@ import { Resource } from './Resource'; import { ResourceDetectionConfig } from './config'; +import { SpanAttributes } from '@opentelemetry/api'; -/** Interface for Resource attributes */ -export interface ResourceAttributes { - [key: string]: number | string | boolean; -} +/** + * Interface for Resource attributes. + * General `Attributes` interface is added in api v1.1.0. + * To backward support older api (1.0.x), the deprecated `SpanAttributes` is used here. + */ +export type ResourceAttributes = SpanAttributes; /** * Interface for a Resource Detector. In order to detect resources in parallel