Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 9c9a1db

Browse files
authored
Merge branch 'main' into fix/eslint-config
2 parents 475e0db + f667325 commit 9c9a1db

File tree

7 files changed

+47
-4
lines changed

7 files changed

+47
-4
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## 1.0.0-rc.1
5+
## 0.20.0
6+
7+
### :rocket: Enhancement
8+
9+
* [#69](https://github.com/open-telemetry/opentelemetry-js-api/pull/69) feat(context): add utils method to remove keys from context ([@vmarchaud](https://github.com/vmarchaud))
10+
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan))
11+
12+
### Committers: 2
13+
14+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
15+
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
16+
17+
## 0.19.0
618

719
### :boom: Breaking Change
820

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentelemetry/api",
3-
"version": "0.19.0",
3+
"version": "0.20.0",
44
"description": "Public API for OpenTelemetry",
55
"main": "build/src/index.js",
66
"module": "build/esm/index.js",

src/api/propagation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ import {
2828
registerGlobal,
2929
unregisterGlobal,
3030
} from '../internal/global-utils';
31-
import { getBaggage, setBaggage } from '../baggage/context-helpers';
31+
import {
32+
getBaggage,
33+
setBaggage,
34+
deleteBaggage,
35+
} from '../baggage/context-helpers';
3236
import { createBaggage } from '../baggage/utils';
3337

3438
const API_NAME = 'propagation';
@@ -108,6 +112,8 @@ export class PropagationAPI {
108112

109113
public setBaggage = setBaggage;
110114

115+
public deleteBaggage = deleteBaggage;
116+
111117
private _getGlobalPropagator(): TextMapPropagator {
112118
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
113119
}

src/api/trace.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { Tracer } from '../trace/tracer';
2828
import { TracerProvider } from '../trace/tracer_provider';
2929
import {
30+
deleteSpan,
3031
getSpan,
3132
getSpanContext,
3233
setSpan,
@@ -89,6 +90,8 @@ export class TraceAPI {
8990

9091
public isSpanContextValid = isSpanContextValid;
9192

93+
public deleteSpan = deleteSpan;
94+
9295
public getSpan = getSpan;
9396

9497
public getSpanContext = getSpanContext;

src/baggage/context-helpers.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { Baggage } from './types';
2424
const BAGGAGE_KEY = createContextKey('OpenTelemetry Baggage Key');
2525

2626
/**
27+
* Retrieve the current baggage from the given context
28+
*
2729
* @param {Context} Context that manage all context values
2830
* @returns {Baggage} Extracted baggage from the context
2931
*/
@@ -32,9 +34,20 @@ export function getBaggage(context: Context): Baggage | undefined {
3234
}
3335

3436
/**
37+
* Store a baggage in the given context
38+
*
3539
* @param {Context} Context that manage all context values
3640
* @param {Baggage} baggage that will be set in the actual context
3741
*/
3842
export function setBaggage(context: Context, baggage: Baggage): Context {
3943
return context.setValue(BAGGAGE_KEY, baggage);
4044
}
45+
46+
/**
47+
* Delete the baggage stored in the given context
48+
*
49+
* @param {Context} Context that manage all context values
50+
*/
51+
export function deleteBaggage(context: Context): Context {
52+
return context.deleteValue(BAGGAGE_KEY);
53+
}

src/trace/context-utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ export function setSpan(context: Context, span: Span): Context {
4444
return context.setValue(SPAN_KEY, span);
4545
}
4646

47+
/**
48+
* Remove current span stored in the context
49+
*
50+
* @param context context to delete span from
51+
*/
52+
export function deleteSpan(context: Context): Context {
53+
return context.deleteValue(SPAN_KEY);
54+
}
55+
4756
/**
4857
* Wrap span context in a NoopSpan and set as span in a new
4958
* context

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
*/
1616

1717
// this is autogenerated file, see scripts/version-update.js
18-
export const VERSION = '0.19.0';
18+
export const VERSION = '0.20.0';

0 commit comments

Comments
 (0)