Skip to content

Commit 0be7c90

Browse files
authored
Merge branch 'next' into feat/remove-addmetricreader
2 parents 86392ac + 0aba75c commit 0be7c90

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed

CHANGELOG_NEXT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
### :boom: Breaking Change
44

5+
* chore(shim-opentracing): replace deprecated SpanAttributes [#4430](https://github.com/open-telemetry/opentelemetry-js/pull/4430) @JamieDanielson
56
* chore(otel-core): replace deprecated SpanAttributes [#4408](https://github.com/open-telemetry/opentelemetry-js/pull/4408) @JamieDanielson
67
* feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option [#4419](https://github.com/open-telemetry/opentelemetry-js/pull/4419) @pichlermarc
8+
* chore(otel-resources): replace deprecated SpanAttributes [#4428](https://github.com/open-telemetry/opentelemetry-js/pull/4428) @JamieDanielson
79

810
### :rocket: (Enhancement)
911

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opentelemetry-resources/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"access": "public"
6262
},
6363
"devDependencies": {
64-
"@opentelemetry/api": ">=1.0.0 <1.8.0",
64+
"@opentelemetry/api": ">=1.1.0 <1.8.0",
6565
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/[email protected]",
6666
"@types/mocha": "10.0.6",
6767
"@types/node": "18.6.5",

packages/opentelemetry-resources/src/Resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class Resource implements IResource {
119119
merge(other: IResource | null): IResource {
120120
if (!other) return this;
121121

122-
// SpanAttributes from other resource overwrite attributes from this resource.
122+
// Attributes from other resource overwrite attributes from this resource.
123123
const mergedSyncAttributes = {
124124
...this._syncAttributes,
125125
//Support for old resource implementation where _syncAttributes is not defined

packages/opentelemetry-resources/src/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
*/
1616

1717
import { ResourceDetectionConfig } from './config';
18-
import { SpanAttributes } from '@opentelemetry/api';
18+
import { Attributes } from '@opentelemetry/api';
1919
import { IResource } from './IResource';
2020

2121
/**
2222
* Interface for Resource attributes.
23-
* General `Attributes` interface is added in api v1.1.0.
24-
* To backward support older api (1.0.x), the deprecated `SpanAttributes` is used here.
2523
*/
26-
export type ResourceAttributes = SpanAttributes;
24+
// TODO: replace ResourceAttributes with Attributes
25+
export type ResourceAttributes = Attributes;
2726

2827
/**
2928
* @deprecated please use {@link DetectorSync}

packages/opentelemetry-shim-opentracing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"access": "public"
4343
},
4444
"devDependencies": {
45-
"@opentelemetry/api": ">=1.0.0 <1.8.0",
45+
"@opentelemetry/api": ">=1.1.0 <1.8.0",
4646
"@opentelemetry/propagator-b3": "1.18.1",
4747
"@opentelemetry/propagator-jaeger": "1.18.1",
4848
"@opentelemetry/sdk-trace-base": "1.18.1",

packages/opentelemetry-shim-opentracing/src/shim.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import * as api from '@opentelemetry/api';
1818
import {
19-
SpanAttributes,
20-
SpanAttributeValue,
19+
Attributes,
20+
AttributeValue,
2121
SpanStatusCode,
2222
TextMapPropagator,
2323
} from '@opentelemetry/api';
@@ -287,7 +287,7 @@ export class SpanShim extends opentracing.Span {
287287
* @param eventName name of the event.
288288
* @param payload an arbitrary object to be attached to the event.
289289
*/
290-
override logEvent(eventName: string, payload?: SpanAttributes): void {
290+
override logEvent(eventName: string, payload?: Attributes): void {
291291
this._logInternal(eventName, payload);
292292
}
293293

@@ -297,7 +297,7 @@ export class SpanShim extends opentracing.Span {
297297
* @param keyValuePairs a set of key-value pairs to be used as event attributes
298298
* @param timestamp optional timestamp for the event
299299
*/
300-
override log(keyValuePairs: SpanAttributes, timestamp?: number): this {
300+
override log(keyValuePairs: Attributes, timestamp?: number): this {
301301
const entries = Object.entries(keyValuePairs);
302302
const eventEntry = entries.find(([key, _]) => key === 'event');
303303
const eventName = eventEntry?.[1] || 'log';
@@ -309,7 +309,7 @@ export class SpanShim extends opentracing.Span {
309309

310310
private _logInternal(
311311
eventName: string,
312-
attributes: SpanAttributes | undefined,
312+
attributes: Attributes | undefined,
313313
timestamp?: number
314314
): void {
315315
if (attributes && eventName === 'error') {
@@ -321,7 +321,7 @@ export class SpanShim extends opentracing.Span {
321321
return;
322322
}
323323

324-
const mappedAttributes: api.SpanAttributes = {};
324+
const mappedAttributes: api.Attributes = {};
325325
for (const [k, v] of entries) {
326326
switch (k) {
327327
case 'error.kind': {
@@ -352,7 +352,7 @@ export class SpanShim extends opentracing.Span {
352352
* Adds a set of tags to the span.
353353
* @param keyValueMap set of KV pairs representing tags
354354
*/
355-
override addTags(keyValueMap: SpanAttributes): this {
355+
override addTags(keyValueMap: Attributes): this {
356356
for (const [key, value] of Object.entries(keyValueMap)) {
357357
if (this._setErrorAsSpanStatusCode(key, value)) {
358358
continue;
@@ -370,7 +370,7 @@ export class SpanShim extends opentracing.Span {
370370
* @param key key for the tag
371371
* @param value value for the tag
372372
*/
373-
override setTag(key: string, value: SpanAttributeValue): this {
373+
override setTag(key: string, value: AttributeValue): this {
374374
if (this._setErrorAsSpanStatusCode(key, value)) {
375375
return this;
376376
}
@@ -398,7 +398,7 @@ export class SpanShim extends opentracing.Span {
398398

399399
private _setErrorAsSpanStatusCode(
400400
key: string,
401-
value: SpanAttributeValue | undefined
401+
value: AttributeValue | undefined
402402
): boolean {
403403
if (key === opentracing.Tags.ERROR) {
404404
const statusCode = SpanShim._mapErrorTag(value);
@@ -409,7 +409,7 @@ export class SpanShim extends opentracing.Span {
409409
}
410410

411411
private static _mapErrorTag(
412-
value: SpanAttributeValue | undefined
412+
value: AttributeValue | undefined
413413
): SpanStatusCode {
414414
switch (value) {
415415
case true:

0 commit comments

Comments
 (0)