Skip to content

Commit 634c475

Browse files
committed
moved AnyValue to Log API, updated changelog
1 parent f215a17 commit 634c475

File tree

8 files changed

+39
-22
lines changed

8 files changed

+39
-22
lines changed

api/src/common/Attributes.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,3 @@ export type AttributeValue =
3535
| Array<null | undefined | string>
3636
| Array<null | undefined | number>
3737
| Array<null | undefined | boolean>;
38-
39-
/**
40-
* AnyValueMap is a map from string to AnyValue (attribute value or a nested map)
41-
*/
42-
export interface AnyValueMap {
43-
[attributeKey: string]: AnyValue | undefined;
44-
}
45-
46-
/**
47-
* AnyValue is a either an attribute value or a map of AnyValue(s)
48-
*/
49-
export type AnyValue = AttributeValue | AnyValueMap;

api/src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ export { BaggageEntry, BaggageEntryMetadata, Baggage } from './baggage/types';
1818
export { baggageEntryMetadataFromString } from './baggage/utils';
1919
export { Exception } from './common/Exception';
2020
export { HrTime, TimeInput } from './common/Time';
21-
export {
22-
Attributes,
23-
AttributeValue,
24-
AnyValue,
25-
AnyValueMap,
26-
} from './common/Attributes';
21+
export { Attributes, AttributeValue } from './common/Attributes';
2722

2823
// Context APIs
2924
export { createContextKey, ROOT_CONTEXT } from './context/context';

experimental/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ All notable changes to experimental packages in this project will be documented
2121
* 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.
2222
* feat(api-events)!: removed domain from the Events API [#4569](https://github.com/open-telemetry/opentelemetry-js/pull/4569)
2323
* fix(events-api)!: renamed EventEmitter to EventLogger in the Events API [#4569](https://github.com/open-telemetry/opentelemetry-js/pull/4568)
24-
* feat(api-events)!: added data field to the Event interface [4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575)
24+
* feat(api-logs)!: changed LogRecord body data type to AnyValue [#4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575)
25+
and AnyValueMap types [#4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575)
2526

2627
### :rocket: (Enhancement)
2728

2829
* refactor(instr-http): use exported strings for semconv. [#4573](https://github.com/open-telemetry/opentelemetry-js/pull/4573/) @JamieDanielson
2930
* feat(sdk-node): add `HostDetector` as default resource detector
31+
* feat(api-events): added data field to the Event interface [4575](https://github.com/open-telemetry/opentelemetry-js/pull/4575)
3032

3133
### :bug: (Bug Fix)
3234

experimental/packages/api-events/src/types/Event.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { AnyValue, Attributes } from '@opentelemetry/api';
17+
import { Attributes } from '@opentelemetry/api';
18+
import { AnyValue } from '@opentelemetry/api-logs';
1819

1920
export interface Event {
2021
/**

experimental/packages/api-logs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export * from './types/Logger';
1818
export * from './types/LoggerProvider';
1919
export * from './types/LogRecord';
2020
export * from './types/LoggerOptions';
21+
export * from './types/AnyValue';
2122
export * from './NoopLogger';
2223
export * from './NoopLoggerProvider';
2324

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { AttributeValue } from '@opentelemetry/api';
18+
19+
/**
20+
* AnyValueMap is a map from string to AnyValue (attribute value or a nested map)
21+
*/
22+
export interface AnyValueMap {
23+
[attributeKey: string]: AnyValue | undefined;
24+
}
25+
26+
/**
27+
* AnyValue is a either an attribute value or a map of AnyValue(s)
28+
*/
29+
export type AnyValue = AttributeValue | AnyValueMap;

experimental/packages/api-logs/src/types/LogRecord.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { AnyValue, AnyValueMap, Context, TimeInput } from '@opentelemetry/api';
17+
import { Context, TimeInput } from '@opentelemetry/api';
18+
import { AnyValue, AnyValueMap } from './AnyValue';
1819

1920
export type LogBody = AnyValue;
2021
export type LogAttributes = AnyValueMap;

experimental/packages/sdk-logs/src/LogRecord.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class LogRecord implements ReadableLogRecord {
157157
return this;
158158
}
159159

160-
public setBody(body: string) {
160+
public setBody(body: LogBody) {
161161
this.body = body;
162162
return this;
163163
}

0 commit comments

Comments
 (0)