Skip to content

Commit 62cbc1e

Browse files
committed
docs: Small improvements
1 parent fc53353 commit 62cbc1e

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

packages/minimal/src/index.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,21 @@ export function _callOnClient(method: string, ...args: any[]): void {
177177
}
178178

179179
/**
180-
* Starts a Transaction. This is the entry point to do manual tracing. You can
181-
* add child spans to transactions. Spans themselves can have children, building
182-
* a tree structure. This function returns a Transaction and you need to keep
183-
* track of the instance yourself. When you call `.finish()` on the transaction
184-
* it will be sent to Sentry.
180+
* Starts a new `Transaction` and returns it. This is the entry point to manual
181+
* tracing instrumentation.
182+
*
183+
* A tree structure can be built by adding child spans to the transaction, and
184+
* child spans to other spans. To start a new child span within the transaction
185+
* or any span, call the respective `.startChild()` method.
186+
*
187+
* Every child span must be finished before the transaction is finished,
188+
* otherwise the unfinished spans are discarded.
189+
*
190+
* The transaction must be finished with a call to its `.finish()` method, at
191+
* which point the transaction with all its finished child spans will be sent to
192+
* Sentry.
193+
*
194+
* @param context Properties of the new `Transaction`.
185195
*/
186196
export function startTransaction(context: TransactionContext): Transaction {
187197
return callOnHub('startTransaction', { ...context });

packages/types/src/hub.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ export interface Hub {
174174
traceHeaders(): { [key: string]: string };
175175

176176
/**
177-
* This function starts a span. If there is already a `Span` on the Scope,
178-
* the created Span with the SpanContext will have a reference to it and become it's child.
179-
* Otherwise it'll create a new `Span`.
177+
* Starts a new `Span` and returns it. If there is a `Span` on the `Scope`,
178+
* the new `Span` will be a child of the existing `Span`.
179+
*
180+
* @param context Properties of the new `Span`.
180181
*/
181182
startSpan(context: SpanContext): Span;
182183

183184
/**
184-
* Starts a new transaction and returns it. This is the entry point to manual
185+
* Starts a new `Transaction` and returns it. This is the entry point to manual
185186
* tracing instrumentation.
186187
*
187188
* A tree structure can be built by adding child spans to the transaction, and
@@ -194,6 +195,8 @@ export interface Hub {
194195
* The transaction must be finished with a call to its `.finish()` method, at
195196
* which point the transaction with all its finished child spans will be sent to
196197
* Sentry.
198+
*
199+
* @param context Properties of the new `Transaction`.
197200
*/
198201
startTransaction(context: TransactionContext): Transaction;
199202
}

0 commit comments

Comments
 (0)