Skip to content

Commit

Permalink
plz
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Sep 30, 2020
1 parent 9fc9d6d commit 56e2c62
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/apm/src/integrations/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ export class Tracing implements Integration {
Tracing._log(`[Tracing] Transaction: ${SpanStatus.Cancelled} since it maxed out maxTransactionDuration`);
if (event.contexts && event.contexts.trace) {
event.contexts.trace = {
...event.contexts.trace,
...(typeof event.contexts.trace === 'object' && event.contexts.trace),
status: SpanStatus.DeadlineExceeded,
};
event.tags = {
Expand Down
6 changes: 4 additions & 2 deletions packages/hub/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import {
Breadcrumb,
CaptureContext,
Context,
Contexts,
Event,
EventHint,
EventProcessor,
Expand Down Expand Up @@ -43,7 +45,7 @@ export class Scope implements ScopeInterface {
protected _extra: Extras = {};

/** Contexts */
protected _contexts: { [key: string]: Record<string, unknown> } = {};
protected _contexts: Contexts = {};

/** Fingerprint */
protected _fingerprint?: string[];
Expand Down Expand Up @@ -183,7 +185,7 @@ export class Scope implements ScopeInterface {
/**
* @inheritDoc
*/
public setContext(key: string, context: Record<string, unknown> | null): this {
public setContext(key: string, context: Context | null): this {
if (context === null) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this._contexts[key];
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type Context = unknown;
export type Contexts = Record<string, Context>;
8 changes: 4 additions & 4 deletions packages/types/src/event.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Breadcrumb } from './breadcrumb';
import { Contexts } from './context';
import { Exception } from './exception';
import { Extras } from './extra';
import { Request } from './request';
import { CaptureContext } from './scope';
import { SdkInfo } from './sdkinfo';
Expand Down Expand Up @@ -31,11 +33,9 @@ export interface Event {
};
stacktrace?: Stacktrace;
breadcrumbs?: Breadcrumb[];
contexts?: {
[key: string]: Record<any, any>;
};
contexts?: Contexts;
tags?: { [key: string]: string };
extra?: { [key: string]: any };
extra?: Extras;
user?: User;
type?: EventType;
spans?: Span[];
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { Breadcrumb, BreadcrumbHint } from './breadcrumb';
export { Client } from './client';
export { Context, Contexts } from './context';
export { Dsn, DsnComponents, DsnLike, DsnProtocol } from './dsn';
export { ExtendedError } from './error';
export { Event, EventHint } from './event';
Expand Down
5 changes: 3 additions & 2 deletions packages/types/src/scope.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Breadcrumb } from './breadcrumb';
import { Context, Contexts } from './context';
import { EventProcessor } from './eventprocessor';
import { Extra, Extras } from './extra';
import { Severity } from './severity';
Expand All @@ -14,7 +15,7 @@ export interface ScopeContext {
user: User;
level: Severity;
extra: Extras;
contexts: { [key: string]: Record<string, unknown> };
contexts: Contexts;
tags: { [key: string]: string };
fingerprint: string[];
}
Expand Down Expand Up @@ -82,7 +83,7 @@ export interface Scope {
* @param name of the context
* @param context Any kind of data. This data will be normailzed.
*/
setContext(name: string, context: Record<string, unknown> | null): this;
setContext(name: string, context: Context | null): this;

/**
* Sets the Span on the scope.
Expand Down

0 comments on commit 56e2c62

Please sign in to comment.