Skip to content

Commit 3651dcf

Browse files
committed
Add setEnvironment span option
Allows adding information to the span's environment -- currently, the integration reports information to AppSignal about the browser and the transport used. This might allow us to send other kinds of information, such as which integration was used to report a given error.
1 parent ea9b9d3 commit 3651dcf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/javascript/src/span.ts

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ export class Span extends Serializable<JSSpanData> {
7070
return this
7171
}
7272

73+
public setEnvironment(environment: HashMap<string>): this {
74+
this._data.environment = { ...this._data.environment, ...environment }
75+
return this
76+
}
77+
7378
// @private
7479
// Do not use this function directly. Instead, set the `matchBacktracePaths`
7580
// configuration option when initializing AppSignal.

packages/types/src/interfaces/span.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface JSSpan {
1818
setParams(params: HashMap<any>): this
1919

2020
setBreadcrumbs(breadcrumbs: Breadcrumb[]): this
21+
22+
setEnvironment(environment: HashMap<string>): this
2123
}
2224

2325
/**

0 commit comments

Comments
 (0)