Skip to content

Commit

Permalink
fix: Add tracestate to the TransactionOptions TypeScript type (#3063
Browse files Browse the repository at this point in the history
)

This is the options parameter to `apm.startTransaction(..., options)`.

Fixes: #3061
  • Loading branch information
trentm authored Dec 9, 2022
1 parent a3c87e1 commit 62c8f67
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Notes:
[float]
===== Bug fixes
* Add `tracestate` to the `TransactionOptions` TypeScript type for
`apm.startTransaction(..., options)`. ({issues}3061[#3061])
[float]
===== Chores
Expand Down
4 changes: 3 additions & 1 deletion docs/agent-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ Sub-millisecond precision can be achieved using decimals.
If not provided,
the current time will be used

** `childOf` +{type-string}+ The traceparent header received from a remote service.
** `childOf` +{type-string}+ A W3C trace-context "traceparent" string, typically received from a remote service call.

** `tracestate` +{type-string}+ A W3C trace-context "tracestate" string.

** `links` +{type-array}+ Span links.
A transaction can refer to zero or more other transactions or spans (separate
Expand Down
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ declare namespace apm {

export interface TransactionOptions {
startTime?: number;
// `childOf` is a W3C trace-context 'traceparent' string. Passing a
// Transaction or Span is deprecated.
childOf?: Transaction | Span | string;
tracestate?: string; // A W3C trace-context 'tracestate' string.
links?: Link[];
}

Expand Down
2 changes: 2 additions & 0 deletions test/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ apm.startTransaction('foo', { startTime: 1 })
apm.startTransaction('foo', 'type', { startTime: 1 })
apm.startTransaction('foo', 'type', 'subtype', { startTime: 1 })
apm.startTransaction('foo', 'type', 'subtype', 'action', { startTime: 1 })
apm.startTransaction('foo', { childOf: '00-12345678901234567890123456789012-1234567890123456-01' })
apm.startTransaction('foo', { tracestate: 'foo=42,bar=43' })
apm.startTransaction('foo', { links: [{ context: '00-12345678901234567890123456789012-1234567890123456-01' }] })

apm.setTransactionName('foo')
Expand Down

0 comments on commit 62c8f67

Please sign in to comment.