diff --git a/api/src/common/Attributes.ts b/api/src/common/Attributes.ts index d02187302b7..53a8166d844 100644 --- a/api/src/common/Attributes.ts +++ b/api/src/common/Attributes.ts @@ -35,15 +35,3 @@ export type AttributeValue = | Array | Array | Array; - -/** - * AnyValueMap is a map from string to AnyValue (attribute value or a nested map) - */ -export interface AnyValueMap { - [attributeKey: string]: AnyValue | undefined; -} - -/** - * AnyValue is a either an attribute value or a map of AnyValue(s) - */ -export type AnyValue = AttributeValue | AnyValueMap; diff --git a/api/src/index.ts b/api/src/index.ts index 108e56c6ee8..c5dbe1685bf 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -18,12 +18,7 @@ export { BaggageEntry, BaggageEntryMetadata, Baggage } from './baggage/types'; export { baggageEntryMetadataFromString } from './baggage/utils'; export { Exception } from './common/Exception'; export { HrTime, TimeInput } from './common/Time'; -export { - Attributes, - AttributeValue, - AnyValue, - AnyValueMap, -} from './common/Attributes'; +export { Attributes, AttributeValue } from './common/Attributes'; // Context APIs export { createContextKey, ROOT_CONTEXT } from './context/context'; diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index b8153427b99..eb535147df7 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -21,12 +21,14 @@ All notable changes to experimental packages in this project will be documented * was used internally to keep track of the compression to use but was unintentionally exposed to the users. It allowed to read and write the value, writing, however, would have no effect. * feat(api-events)!: removed domain from the Events API [#4569](https://github.com/open-telemetry/opentelemetry-js/pull/4569) * fix(events-api)!: renamed EventEmitter to EventLogger in the Events API [#4569](https://github.com/open-telemetry/opentelemetry-js/pull/4568) -* feat(api-events)!: added data field to the Event interface [4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575) +* feat(api-logs)!: changed LogRecord body data type to AnyValue [#4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575) +and AnyValueMap types [#4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575) ### :rocket: (Enhancement) * refactor(instr-http): use exported strings for semconv. [#4573](https://github.com/open-telemetry/opentelemetry-js/pull/4573/) @JamieDanielson * feat(sdk-node): add `HostDetector` as default resource detector +* feat(api-events): added data field to the Event interface [4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575) ### :bug: (Bug Fix) diff --git a/experimental/packages/api-events/src/types/Event.ts b/experimental/packages/api-events/src/types/Event.ts index 00f68aea141..58456311cbf 100644 --- a/experimental/packages/api-events/src/types/Event.ts +++ b/experimental/packages/api-events/src/types/Event.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { AnyValue, Attributes } from '@opentelemetry/api'; +import { Attributes } from '@opentelemetry/api'; +import { AnyValue } from '@opentelemetry/api-logs'; export interface Event { /** diff --git a/experimental/packages/api-logs/src/index.ts b/experimental/packages/api-logs/src/index.ts index 34b4d8e20ee..3ea2ae39c8b 100644 --- a/experimental/packages/api-logs/src/index.ts +++ b/experimental/packages/api-logs/src/index.ts @@ -18,6 +18,7 @@ export * from './types/Logger'; export * from './types/LoggerProvider'; export * from './types/LogRecord'; export * from './types/LoggerOptions'; +export * from './types/AnyValue'; export * from './NoopLogger'; export * from './NoopLoggerProvider'; diff --git a/experimental/packages/api-logs/src/types/AnyValue.ts b/experimental/packages/api-logs/src/types/AnyValue.ts new file mode 100644 index 00000000000..7a97de7ed60 --- /dev/null +++ b/experimental/packages/api-logs/src/types/AnyValue.ts @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AttributeValue } from '@opentelemetry/api'; + +/** + * AnyValueMap is a map from string to AnyValue (attribute value or a nested map) + */ +export interface AnyValueMap { + [attributeKey: string]: AnyValue | undefined; +} + +/** + * AnyValue is a either an attribute value or a map of AnyValue(s) + */ +export type AnyValue = AttributeValue | AnyValueMap; diff --git a/experimental/packages/api-logs/src/types/LogRecord.ts b/experimental/packages/api-logs/src/types/LogRecord.ts index f4e8b200381..85d5e4ff4dd 100644 --- a/experimental/packages/api-logs/src/types/LogRecord.ts +++ b/experimental/packages/api-logs/src/types/LogRecord.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { AnyValue, AnyValueMap, Context, TimeInput } from '@opentelemetry/api'; +import { Context, TimeInput } from '@opentelemetry/api'; +import { AnyValue, AnyValueMap } from './AnyValue'; export type LogBody = AnyValue; export type LogAttributes = AnyValueMap; diff --git a/experimental/packages/sdk-logs/src/LogRecord.ts b/experimental/packages/sdk-logs/src/LogRecord.ts index 39162597d13..abc4f452855 100644 --- a/experimental/packages/sdk-logs/src/LogRecord.ts +++ b/experimental/packages/sdk-logs/src/LogRecord.ts @@ -157,7 +157,7 @@ export class LogRecord implements ReadableLogRecord { return this; } - public setBody(body: string) { + public setBody(body: LogBody) { this.body = body; return this; }