Skip to content

Commit 6d675ed

Browse files
committed
fix some errors
1 parent 876bc8a commit 6d675ed

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

packages/apm/src/index.bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if (_window.Sentry && _window.Sentry.Integrations) {
6767
}
6868
// tslint:enable: no-unsafe-any
6969

70-
const INTEGRATIONS = {
70+
const INTEGRATIONS: any = {
7171
...windowIntegrations,
7272
...BrowserIntegrations,
7373
Tracing: ApmIntegrations.Tracing,

packages/tracing/src/hubextensions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getMainCarrier, Hub } from '@sentry/hub';
22
import { SpanContext, TransactionContext } from '@sentry/types';
33
import { logger } from '@sentry/utils';
44

5+
import { IdleTransaction } from './idletransaction';
56
import { Span } from './span';
67
import { Transaction } from './transaction';
78

@@ -22,8 +23,8 @@ function traceHeaders(this: Hub): { [key: string]: string } {
2223
/**
2324
* {@see Hub.startTransaction}
2425
*/
25-
function startTransaction(this: Hub, context: TransactionContext): Transaction {
26-
const transaction = new Transaction(context, this);
26+
function startTransaction(this: Hub, context: TransactionContext, idleTimeout?: number): Transaction {
27+
const transaction = idleTimeout ? new IdleTransaction(context, this, idleTimeout) : new Transaction(context, this);
2728

2829
const client = this.getClient();
2930
// Roll the dice for sampling transaction, all child spans inherit the sampling decision.

packages/tracing/src/index.bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if (_window.Sentry && _window.Sentry.Integrations) {
6767
}
6868
// tslint:enable: no-unsafe-any
6969

70-
const INTEGRATIONS = {
70+
const INTEGRATIONS: any = {
7171
...windowIntegrations,
7272
...BrowserIntegrations,
7373
Tracing: TracingIntegrations.BrowserTracing,

packages/tracing/src/integrations/tracing/request.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ interface FetchData {
7979
*/
8080
interface XHRData {
8181
xhr?: {
82-
__sentry_xhr__?: Record<string, any>;
82+
__sentry_xhr__?: {
83+
method: string;
84+
url: string;
85+
status_code: number;
86+
data: Record<string, any>;
87+
};
8388
__sentry_xhr_span_id__?: string;
8489
__sentry_own_request__: boolean;
8590
setRequestHeader?: Function;
@@ -206,7 +211,7 @@ function xhrCallback(handlerData: XHRData, shouldCreateSpan: (url: string) => bo
206211
}
207212

208213
const xhr = handlerData.xhr.__sentry_xhr__;
209-
if (!shouldCreateSpan(xhr.url as string)) {
214+
if (!shouldCreateSpan(xhr.url)) {
210215
return;
211216
}
212217

@@ -218,13 +223,9 @@ function xhrCallback(handlerData: XHRData, shouldCreateSpan: (url: string) => bo
218223
if (handlerData.endTimestamp && handlerData.xhr.__sentry_xhr_span_id__) {
219224
const span = RequestTracing.spans[handlerData.xhr.__sentry_xhr_span_id__];
220225
if (span) {
221-
Object.keys(handlerData.xhr.__sentry_xhr__).forEach((key: string) => {
222-
const val = handlerData.xhr && handlerData.xhr.__sentry_xhr__ && handlerData.xhr.__sentry_xhr__.key;
223-
if (val) {
224-
span.setData(key, val);
225-
}
226-
});
227-
226+
span.setData('url', xhr.url);
227+
span.setData('method', xhr.method);
228+
span.setHttpStatus(xhr.status_code);
228229
span.finish();
229230
}
230231
return;

0 commit comments

Comments
 (0)