Skip to content

Commit

Permalink
Merge branch 'next' into feat/remove-addmetricreader
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Jan 24, 2024
2 parents 86392ac + 0aba75c commit 0be7c90
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_NEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

### :boom: Breaking Change

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

### :rocket: (Enhancement)

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"access": "public"
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.8.0",
"@opentelemetry/api": ">=1.1.0 <1.8.0",
"@opentelemetry/resources_1.9.0": "npm:@opentelemetry/[email protected]",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/src/Resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class Resource implements IResource {
merge(other: IResource | null): IResource {
if (!other) return this;

// SpanAttributes from other resource overwrite attributes from this resource.
// Attributes from other resource overwrite attributes from this resource.
const mergedSyncAttributes = {
...this._syncAttributes,
//Support for old resource implementation where _syncAttributes is not defined
Expand Down
7 changes: 3 additions & 4 deletions packages/opentelemetry-resources/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/

import { ResourceDetectionConfig } from './config';
import { SpanAttributes } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api';
import { IResource } from './IResource';

/**
* 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;
// TODO: replace ResourceAttributes with Attributes
export type ResourceAttributes = Attributes;

/**
* @deprecated please use {@link DetectorSync}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-shim-opentracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"access": "public"
},
"devDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.8.0",
"@opentelemetry/api": ">=1.1.0 <1.8.0",
"@opentelemetry/propagator-b3": "1.18.1",
"@opentelemetry/propagator-jaeger": "1.18.1",
"@opentelemetry/sdk-trace-base": "1.18.1",
Expand Down
20 changes: 10 additions & 10 deletions packages/opentelemetry-shim-opentracing/src/shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import * as api from '@opentelemetry/api';
import {
SpanAttributes,
SpanAttributeValue,
Attributes,
AttributeValue,
SpanStatusCode,
TextMapPropagator,
} from '@opentelemetry/api';
Expand Down Expand Up @@ -287,7 +287,7 @@ export class SpanShim extends opentracing.Span {
* @param eventName name of the event.
* @param payload an arbitrary object to be attached to the event.
*/
override logEvent(eventName: string, payload?: SpanAttributes): void {
override logEvent(eventName: string, payload?: Attributes): void {
this._logInternal(eventName, payload);
}

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

private _logInternal(
eventName: string,
attributes: SpanAttributes | undefined,
attributes: Attributes | undefined,
timestamp?: number
): void {
if (attributes && eventName === 'error') {
Expand All @@ -321,7 +321,7 @@ export class SpanShim extends opentracing.Span {
return;
}

const mappedAttributes: api.SpanAttributes = {};
const mappedAttributes: api.Attributes = {};
for (const [k, v] of entries) {
switch (k) {
case 'error.kind': {
Expand Down Expand Up @@ -352,7 +352,7 @@ export class SpanShim extends opentracing.Span {
* Adds a set of tags to the span.
* @param keyValueMap set of KV pairs representing tags
*/
override addTags(keyValueMap: SpanAttributes): this {
override addTags(keyValueMap: Attributes): this {
for (const [key, value] of Object.entries(keyValueMap)) {
if (this._setErrorAsSpanStatusCode(key, value)) {
continue;
Expand All @@ -370,7 +370,7 @@ export class SpanShim extends opentracing.Span {
* @param key key for the tag
* @param value value for the tag
*/
override setTag(key: string, value: SpanAttributeValue): this {
override setTag(key: string, value: AttributeValue): this {
if (this._setErrorAsSpanStatusCode(key, value)) {
return this;
}
Expand Down Expand Up @@ -398,7 +398,7 @@ export class SpanShim extends opentracing.Span {

private _setErrorAsSpanStatusCode(
key: string,
value: SpanAttributeValue | undefined
value: AttributeValue | undefined
): boolean {
if (key === opentracing.Tags.ERROR) {
const statusCode = SpanShim._mapErrorTag(value);
Expand All @@ -409,7 +409,7 @@ export class SpanShim extends opentracing.Span {
}

private static _mapErrorTag(
value: SpanAttributeValue | undefined
value: AttributeValue | undefined
): SpanStatusCode {
switch (value) {
case true:
Expand Down

0 comments on commit 0be7c90

Please sign in to comment.