Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
### :bug: Bug Fixes

* fix(opentelemetry-instrumentation): improve `_warnOnPreloadedModules` function not to show warning logs when the module is not marked as loaded [#6095](https://github.com/open-telemetry/opentelemetry-js/pull/6095) @rlj1202
* fix(sdk-trace-base): derive internal `SpanOptions` from API type to prevent drift [#6478](https://github.com/open-telemetry/opentelemetry-js/pull/6478) @overbalance

### :books: Documentation

Expand Down
1 change: 1 addition & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.

* fix(api): prioritize `esnext` export condition as it is more specific [#5458](https://github.com/open-telemetry/opentelemetry-js/pull/5458)
* fix(api): update diag `consoleLogger` to use original console methods to prevent infinite loop when a console instrumentation is present [#6395](https://github.com/open-telemetry/opentelemetry-js/pull/6395)
* fix(api): use `Attributes` instead of deprecated `SpanAttributes` in `SpanOptions` [#6478](https://github.com/open-telemetry/opentelemetry-js/pull/6478) @overbalance

### :books: (Refine Doc)

Expand Down
4 changes: 2 additions & 2 deletions api/src/trace/SpanOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { Attributes } from '../common/Attributes';
import type { TimeInput } from '../common/Time';
import type { SpanAttributes } from './attributes';
import type { Link } from './link';
import type { SpanKind } from './span_kind';

Expand All @@ -21,7 +21,7 @@ export interface SpanOptions {
kind?: SpanKind;

/** A span's attributes */
attributes?: SpanAttributes;
attributes?: Attributes;

/** {@link Link}s span to other spans */
links?: Link[];
Expand Down
12 changes: 7 additions & 5 deletions packages/opentelemetry-sdk-trace-base/src/Span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
HrTime,
Link,
Span as APISpan,
SpanOptions as APISpanOptions,
Attributes,
AttributeValue,
SpanContext,
Expand Down Expand Up @@ -47,21 +48,22 @@ import type { SpanLimits } from './types';
*/
export type Span = APISpan & ReadableSpan;

interface SpanOptions {
// `root` is omitted because it is consumed by Tracer.startSpan() to strip
// parent context but it has no meaning when constructing a Span directly.
type SpanOptions = Omit<APISpanOptions, 'root'> & {
resource: Resource;
scope: InstrumentationScope;
context: Context;
spanContext: SpanContext;
name: string;
// Required here to override optional `kind` from the API's SpanOptions
// SpanImpl assigns it unconditionally and ReadableSpan expects it to be set.
kind: SpanKind;
parentSpanContext?: SpanContext;
links?: Link[];
startTime?: TimeInput;
attributes?: Attributes;
spanLimits: SpanLimits;
spanProcessor: SpanProcessor;
recordEndMetrics?: () => void;
}
};

/**
* This class represents a span.
Expand Down