Skip to content

Commit ad0a452

Browse files
committed
fix: Wording and condition check
1 parent f7f18d7 commit ad0a452

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

packages/apm/src/hubextensions.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,15 @@ function traceHeaders(this: Hub): { [key: string]: string } {
2020
}
2121

2222
/**
23-
* This functions starts a span. If there is already a `Span` on the Scope,
24-
* the created Span with the SpanContext will have a reference to it and become it's child.
25-
* Otherwise it'll crete a new `Span`.
26-
*
27-
* @param context Properties with which the span should be created
23+
* {@see Hub.startSpan}
2824
*/
2925
function startSpan(this: Hub, context: SpanContext | TransactionContext): Transaction | Span {
3026
/**
3127
* @deprecated
3228
* We have this here as a fallback to not break users upgrading to the new API
3329
*/
34-
if ((context as any).transaction) {
35-
logger.warn(
36-
`Please use \`Sentry.startTransaction({name: ${(context as any).transaction}})\` to start a Transaction.`,
37-
);
30+
if ((context as any).transaction !== undefined) {
31+
logger.warn(`Use \`Sentry.startTransaction({name: ${(context as any).transaction}})\` to start a Transaction.`);
3832
(context as TransactionContext).name = (context as any).transaction as string;
3933
(context as TransactionContext)._isTransaction = true;
4034
}
@@ -44,8 +38,9 @@ function startSpan(this: Hub, context: SpanContext | TransactionContext): Transa
4438
// if the user really wanted to create a Transaction.
4539
if ((context as TransactionContext)._isTransaction && !(context as TransactionContext).name) {
4640
logger.warn('You are trying to start a Transaction but forgot to provide a `name` property.');
47-
logger.warn('Will fall back to <unlabeled transaction>, use `transaction.setName()` to change it.');
48-
(context as TransactionContext).name = '<unlabeled transaction>';
41+
const name = '<unlabeled transaction>';
42+
logger.warn(`Will fall back to \`${name}\``);
43+
(context as TransactionContext).name = name;
4944
}
5045

5146
if ((context as TransactionContext).name) {

packages/types/src/hub.ts

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

176176
/**
177-
* This functions starts either a Span or a Transaction (depending on the argument passed).
178-
* If there is a Span on the Scope we use the `trace_id` for all other created Transactions / Spans as a reference.
177+
* This functions starts either a Span or a Transaction (depending on the context).
178+
* If there is a Span on the Scope, the created Span will be a child.
179179
*
180180
* @param context Properties with which the Transaction/Span should be created
181181
*/

0 commit comments

Comments
 (0)