@sentry/types
- Version 6.19.7
- Published
- 406 kB
- No dependencies
- BSD-3-Clause license
Install
npm i @sentry/types
yarn add @sentry/types
pnpm add @sentry/types
Overview
Types for all Sentry JavaScript SDKs
Index
Variables
Interfaces
Hub
- addBreadcrumb()
- bindClient()
- captureEvent()
- captureException()
- captureMessage()
- captureSession()
- configureScope()
- endSession()
- getClient()
- getIntegration()
- isOlderThan()
- lastEventId()
- popScope()
- pushScope()
- run()
- setContext()
- setExtra()
- setExtras()
- setTag()
- setTags()
- setUser()
- startSession()
- startSpan()
- startTransaction()
- traceHeaders()
- withScope()
Options
- attachStacktrace
- autoSessionTracking
- beforeBreadcrumb
- beforeSend
- debug
- defaultIntegrations
- dist
- dsn
- enabled
- environment
- ignoreErrors
- initialScope
- integrations
- maxBreadcrumbs
- maxValueLength
- normalizeDepth
- normalizeMaxBreadth
- release
- sampleRate
- sendClientReports
- shutdownTimeout
- tracesSampler
- tracesSampleRate
- transport
- transportOptions
- tunnel
Enums
Type Aliases
- AttachmentItem
- BaseEnvelopeHeaders
- BaseEnvelopeItemHeaders
- CaptureContext
- ClientReport
- ClientReportEnvelope
- ClientReportItem
- Context
- Contexts
- DebugImageType
- DsnLike
- DsnProtocol
- Envelope
- EventEnvelope
- EventItem
- EventProcessor
- EventStatus
- Extra
- Extras
- Measurements
- Outcome
- Primitive
- QueryParams
- RequestSessionStatus
- SentryRequestType
- SessionEnvelope
- SessionItem
- SessionStatus
- SeverityLevel
- TraceparentData
- TransactionSamplingMethod
- TransportClass
- UserFeedbackItem
Variables
variable SeverityLevels
const SeverityLevels: readonly [ 'fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
Interfaces
interface AggregationCounts
interface AggregationCounts {}
interface Breadcrumb
interface Breadcrumb {}
JSDoc
interface BreadcrumbHint
interface BreadcrumbHint {}
JSDoc
index signature
[key: string]: any;
interface Client
interface Client<O extends Options = Options> {}
User-Facing Sentry SDK Client.
This interface contains all methods to interface with the SDK once it has been installed. It allows to send events to Sentry, record breadcrumbs and set a context included in every event. Since the SDK mutates its environment, there will only be one instance during runtime.
method captureEvent
captureEvent: ( event: Event, hint?: EventHint, scope?: Scope) => string | undefined;
Captures a manually created event and sends it to Sentry.
Parameter event
The event to send to Sentry.
Parameter hint
May contain additional information about the original exception.
Parameter scope
An optional scope containing event metadata.
Returns
The event id
method captureException
captureException: ( exception: any, hint?: EventHint, scope?: Scope) => string | undefined;
Captures an exception event and sends it to Sentry.
Parameter exception
An exception-like object.
Parameter hint
May contain additional information about the original exception.
Parameter scope
An optional scope containing event metadata.
Returns
The event id
method captureMessage
captureMessage: ( message: string, level?: Severity, hint?: EventHint, scope?: Scope) => string | undefined;
Captures a message event and sends it to Sentry.
Parameter message
The message to send to Sentry.
Parameter level
Define the level of the message.
Parameter hint
May contain additional information about the original exception.
Parameter scope
An optional scope containing event metadata.
Returns
The event id
method captureSession
captureSession: (session: Session) => void;
Captures a session
Parameter session
Session to be delivered
method close
close: (timeout?: number) => PromiseLike<boolean>;
Flush the event queue and set the client to
enabled = false
. See Client.flush.Parameter timeout
Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause the client to wait until all events are sent before disabling itself.
Returns
A promise which resolves to
true
if the flush completes successfully before the timeout, orfalse
if it doesn't.
method flush
flush: (timeout?: number) => PromiseLike<boolean>;
Wait for all events to be sent or the timeout to expire, whichever comes first.
Parameter timeout
Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will cause the client to wait until all events are sent before resolving the promise.
Returns
A promise that will resolve with
true
if all events are sent before the timeout, orfalse
if there are still events in the queue when the timeout is reached.
method getDsn
getDsn: () => DsnComponents | undefined;
Returns the current Dsn.
method getIntegration
getIntegration: <T extends Integration>( integration: IntegrationClass<T>) => T | null;
Returns an array of installed integrations on the client.
method getOptions
getOptions: () => O;
Returns the current options.
method getTransport
getTransport: () => Transport;
Returns clients transport.
method setupIntegrations
setupIntegrations: () => void;
This is an internal function to setup all integrations that should run on the client
interface CustomSamplingContext
interface CustomSamplingContext {}
Context data passed by the user when starting a transaction, to be used by the tracesSampler method.
index signature
[key: string]: any;
interface DebugImage
interface DebugImage {}
References to debug images.
property code_file
code_file: string;
property code_id
code_id?: string | null;
property debug_file
debug_file?: string | null;
property debug_id
debug_id: string;
property type
type: DebugImageType;
interface DebugMeta
interface DebugMeta {}
Holds meta information to customize the behavior of Sentry's server-side event processing.
property images
images?: Array<DebugImage>;
interface DsnComponents
interface DsnComponents {}
Primitive components of a Dsn.
property host
host: string;
Hostname of the Sentry instance.
property pass
pass?: string;
Private authorization key (deprecated, optional).
property path
path?: string;
Sub path/
property port
port?: string;
Port of the Sentry instance.
property projectId
projectId: string;
Project ID
property protocol
protocol: DsnProtocol;
Protocol used to connect to Sentry.
property publicKey
publicKey?: string;
Public authorization key.
property user
user?: string;
Public authorization key (deprecated, renamed to publicKey).
interface Event
interface Event {}
JSDoc
property breadcrumbs
breadcrumbs?: Breadcrumb[];
property contexts
contexts?: Contexts;
property debug_meta
debug_meta?: DebugMeta;
property dist
dist?: string;
property environment
environment?: string;
property event_id
event_id?: string;
property exception
exception?: { values?: Exception[];};
property extra
extra?: Extras;
property fingerprint
fingerprint?: string[];
property level
level?: Severity;
property logger
logger?: string;
property measurements
measurements?: Measurements;
property message
message?: string;
property modules
modules?: { [key: string]: string;};
property platform
platform?: string;
property release
release?: string;
property request
request?: Request;
property sdk
sdk?: SdkInfo;
property sdkProcessingMetadata
sdkProcessingMetadata?: { [key: string]: any;};
property server_name
server_name?: string;
property spans
spans?: Span[];
property stacktrace
stacktrace?: Stacktrace;
property start_timestamp
start_timestamp?: number;
property tags
tags?: { [key: string]: Primitive;};
property timestamp
timestamp?: number;
property transaction
transaction?: string;
property type
type?: EventType;
property user
user?: User;
interface EventHint
interface EventHint {}
JSDoc
property captureContext
captureContext?: CaptureContext;
property data
data?: any;
property event_id
event_id?: string;
property originalException
originalException?: Error | string | null;
property syntheticException
syntheticException?: Error | null;
interface Exception
interface Exception {}
JSDoc
interface ExtendedError
interface ExtendedError extends Error {}
Just an Error object with arbitrary attributes attached to it.
index signature
[key: string]: any;
interface ExtractedNodeRequestData
interface ExtractedNodeRequestData {}
Data extracted from an incoming request to a node server
property cookies
cookies?: { [key: string]: string;};
String representing the cookies sent along with the request
property data
data?: string;
Any data sent in the request's body, as a JSON string
property headers
headers?: { [key: string]: string;};
Specific headers from the request
property method
method?: string;
The request's method
property query_string
query_string?: QueryParams;
The request's query params
property url
url?: string;
The request's URL, including query string
index signature
[key: string]: any;
interface Hub
interface Hub {}
Internal class used to make sure we always have the latest internal functions working in case we have a version conflict.
method addBreadcrumb
addBreadcrumb: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void;
Records a new breadcrumb which will be attached to future events.
Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
Parameter breadcrumb
The breadcrumb to record.
Parameter hint
May contain additional information about the original breadcrumb.
method bindClient
bindClient: (client?: Client) => void;
This binds the given client to the current scope.
Parameter client
An SDK client (client) instance.
method captureEvent
captureEvent: (event: Event, hint?: EventHint) => string;
Captures a manually created event and sends it to Sentry.
Parameter event
The event to send to Sentry.
Parameter hint
May contain additional information about the original exception.
method captureException
captureException: (exception: any, hint?: EventHint) => string;
Captures an exception event and sends it to Sentry.
Parameter exception
An exception-like object.
Parameter hint
May contain additional information about the original exception.
Returns
The generated eventId.
method captureMessage
captureMessage: (message: string, level?: Severity, hint?: EventHint) => string;
Captures a message event and sends it to Sentry.
Parameter message
The message to send to Sentry.
Parameter level
Define the level of the message.
Parameter hint
May contain additional information about the original exception.
Returns
The generated eventId.
method captureSession
captureSession: (endSession?: boolean) => void;
Sends the current session on the scope to Sentry
Parameter endSession
If set the session will be marked as exited and removed from the scope
method configureScope
configureScope: (callback: (scope: Scope) => void) => void;
Callback to set context information onto the scope.
Parameter callback
Callback function that receives Scope.
method endSession
endSession: () => void;
Ends the session that lives on the current scope and sends it to Sentry
method getClient
getClient: () => Client | undefined;
Returns the client of the top stack.
method getIntegration
getIntegration: <T extends Integration>( integration: IntegrationClass<T>) => T | null;
Returns the integration if installed on the current client.
method isOlderThan
isOlderThan: (version: number) => boolean;
Checks if this hub's version is older than the given version.
Parameter version
A version number to compare to. True if the given version is newer; otherwise false.
method lastEventId
lastEventId: () => string | undefined;
This is the getter for lastEventId.
Returns
The last event id of a captured event.
method popScope
popScope: () => boolean;
Removes a previously pushed scope from the stack.
This restores the state before the scope was pushed. All breadcrumbs and context information added since the last call to this.pushScope are discarded.
method pushScope
pushScope: () => Scope;
Create a new scope to store context information.
The scope will be layered on top of the current one. It is isolated, i.e. all breadcrumbs and context information added to this scope will be removed once the scope ends. Be sure to always remove this scope with this.popScope when the operation finishes or throws.
Returns
Scope, the new cloned scope
method run
run: (callback: (hub: Hub) => void) => void;
For the duration of the callback, this hub will be set as the global current Hub. This function is useful if you want to run your own client and hook into an already initialized one e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration.
method setContext
setContext: (name: string, context: { [key: string]: any }) => void;
Sets context data with the given name.
Parameter name
of the context
Parameter context
Any kind of data. This data will be normalized.
method setExtra
setExtra: (key: string, extra: Extra) => void;
Set key:value that will be sent as extra data with the event.
Parameter key
String of extra
Parameter extra
Any kind of data. This data will be normalized.
method setExtras
setExtras: (extras: Extras) => void;
Set an object that will be merged sent as extra data with the event.
Parameter extras
Extras object to merge into current context.
method setTag
setTag: (key: string, value: Primitive) => void;
Set key:value that will be sent as tags data with the event.
Can also be used to unset a tag, by passing
undefined
.Parameter key
String key of tag
Parameter value
Value of tag
method setTags
setTags: (tags: { [key: string]: Primitive }) => void;
Set an object that will be merged sent as tags data with the event.
Parameter tags
Tags context object to merge into current context.
method setUser
setUser: (user: User | null) => void;
Updates user context information for future events.
Parameter user
User context object to be set in the current context. Pass
null
to unset the user.
method startSession
startSession: (context?: SessionContext) => Session;
Starts a new
Session
, sets on the current scope and returns it.To finish a
session
, it has to be passed directly toclient.captureSession
, which is done automatically when usinghub.endSession()
for the session currently stored on the scope.When there's already an existing session on the scope, it'll be automatically ended.
Parameter context
Optional properties of the new
Session
.Returns
The session which was just started
method startSpan
startSpan: (context: SpanContext) => Span;
Deprecated
No longer does anything. Use use Transaction.startChild instead.
method startTransaction
startTransaction: ( context: TransactionContext, customSamplingContext?: CustomSamplingContext) => Transaction;
Starts a new
Transaction
and returns it. This is the entry point to manual tracing instrumentation.A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a new child span within the transaction or any span, call the respective
.startChild()
method.Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
The transaction must be finished with a call to its
.finish()
method, at which point the transaction with all its finished child spans will be sent to Sentry.Parameter context
Properties of the new
Transaction
.Parameter customSamplingContext
Information given to the transaction sampling function (along with context-dependent default values). See Options.tracesSampler.
Returns
The transaction which was just started
method traceHeaders
traceHeaders: () => { [key: string]: string };
Returns all trace headers that are currently on the top scope.
method withScope
withScope: (callback: (scope: Scope) => void) => void;
Creates a new scope with and executes the given operation within. The scope is automatically removed once the operation finishes or throws.
This is essentially a convenience function for:
pushScope(); callback(); popScope();
Parameter callback
that will be enclosed into push/popScope.
interface Integration
interface Integration {}
Integration interface
property name
name: string;
Returns IntegrationClass.id
method setupOnce
setupOnce: ( addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub) => void;
Sets the integration up only once. This takes no options on purpose, options should be passed in the constructor
interface IntegrationClass
interface IntegrationClass<T> {}
Integration Class Interface
property id
id: string;
Property that holds the integration name
construct signature
new (...args: any[]): T;
interface Mechanism
interface Mechanism {}
Metadata about a captured exception, intended to provide a hint as to the means by which it was captured.
property data
data?: { [key: string]: string | boolean;};
Arbitrary data to be associated with the mechanism (for example, errors coming from event handlers include the handler name and the event target. Will show up in the UI directly above the stacktrace.
property handled
handled: boolean;
In theory, whether or not the exception has been handled by the user. In practice, whether or not we see it before it hits the global error/rejection handlers, whether through explicit handling by the user or auto instrumentation. Converted to a tag on ingest and used in various ways in the UI.
property synthetic
synthetic?: boolean;
True when
captureException
is called with anything other than an instance ofError
(or, in the case of browser, an instance ofErrorEvent
,DOMError
, orDOMException
). causing us to create a synthetic error in an attempt to recreate the stacktrace.
property type
type: string;
For now, restricted to
onerror
,onunhandledrejection
(both obvious),instrument
(the result of auto-instrumentation), andgeneric
(everything else). Converted to a tag on ingest.
interface Options
interface Options {}
Base configuration options for every SDK.
property attachStacktrace
attachStacktrace?: boolean;
Attaches stacktraces to pure capture message / log integrations
property autoSessionTracking
autoSessionTracking?: boolean;
A flag enabling Sessions Tracking feature. By default, Sessions Tracking is enabled.
property beforeBreadcrumb
beforeBreadcrumb?: ( breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
A callback invoked when adding a breadcrumb, allowing to optionally modify it before adding it to future events.
Note that you must return a valid breadcrumb from this callback. If you do not wish to modify the breadcrumb, simply return it at the end. Returning null will cause the breadcrumb to be dropped.
Parameter breadcrumb
The breadcrumb as created by the SDK.
Returns
The breadcrumb that will be added | null.
property beforeSend
beforeSend?: ( event: Event, hint?: EventHint) => PromiseLike<Event | null> | Event | null;
A callback invoked during event submission, allowing to optionally modify the event before it is sent to Sentry.
Note that you must return a valid event from this callback. If you do not wish to modify the event, simply return it at the end. Returning null will cause the event to be dropped.
Parameter event
The error or message event generated by the SDK.
Parameter hint
May contain additional information about the original exception.
Returns
A new event that will be sent | null.
property debug
debug?: boolean;
Enable debug functionality in the SDK itself
property defaultIntegrations
defaultIntegrations?: false | Integration[];
If this is set to false, default integrations will not be added, otherwise this will internally be set to the recommended default integrations. TODO: We should consider changing this to
boolean | Integration[]
property dist
dist?: string;
Sets the distribution for all events
property dsn
dsn?: string;
The Dsn used to connect to Sentry and identify the project. If omitted, the SDK will not send any data to Sentry.
property enabled
enabled?: boolean;
Specifies whether this SDK should send events to Sentry. Defaults to true.
property environment
environment?: string;
The current environment of your application (e.g. "production").
property ignoreErrors
ignoreErrors?: Array<string | RegExp>;
A pattern for error messages which should not be sent to Sentry. By default, all errors will be sent.
property initialScope
initialScope?: CaptureContext;
Initial data to populate scope.
property integrations
integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
List of integrations that should be installed after SDK was initialized. Accepts either a list of integrations or a function that receives default integrations and returns a new, updated list.
property maxBreadcrumbs
maxBreadcrumbs?: number;
The maximum number of breadcrumbs sent with events. Defaults to 100. Values over 100 will be ignored and 100 used instead.
property maxValueLength
maxValueLength?: number;
Maximum number of chars a single value can have before it will be truncated.
property normalizeDepth
normalizeDepth?: number;
Maximum number of levels that normalization algorithm will traverse in objects and arrays. Used when normalizing an event before sending, on all of the listed attributes: -
breadcrumbs.data
-user
-contexts
-extra
Defaults to3
. Set to0
to disable.
property normalizeMaxBreadth
normalizeMaxBreadth?: number;
Maximum number of properties or elements that the normalization algorithm will output in any single array or object included in the normalized event. Used when normalizing an event before sending, on all of the listed attributes: -
breadcrumbs.data
-user
-contexts
-extra
Defaults to1000
property release
release?: string;
The release identifier used when uploading respective source maps. Specify this value to allow Sentry to resolve the correct source maps when processing events.
property sampleRate
sampleRate?: number;
A global sample rate to apply to all events (0 - 1).
property sendClientReports
sendClientReports?: boolean;
Send SDK Client Reports. By default, Client Reports are enabled.
property shutdownTimeout
shutdownTimeout?: number;
Controls how many milliseconds to wait before shutting down. The default is SDK-specific but typically around 2 seconds. Setting this too low can cause problems for sending events from command line applications. Setting it too high can cause the application to block for users with network connectivity problems.
property tracesSampler
tracesSampler?: (samplingContext: SamplingContext) => number | boolean;
Function to compute tracing sample rate dynamically and filter unwanted traces.
Tracing is enabled if either this or
tracesSampleRate
is defined. If both are defined,tracesSampleRate
is ignored.Will automatically be passed a context object of default and optional custom data. See Transaction.samplingContext and Hub.startTransaction.
Returns
A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning
true
is equivalent to returning 1 and returningfalse
is equivalent to returning 0.
property tracesSampleRate
tracesSampleRate?: number;
Sample rate to determine trace sampling.
0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send all traces)
Tracing is enabled if either this or
tracesSampler
is defined. If both are defined,tracesSampleRate
is ignored.
property transport
transport?: TransportClass<Transport>;
Transport object that should be used to send events to Sentry
property transportOptions
transportOptions?: TransportOptions;
Options for the default transport that the SDK uses.
property tunnel
tunnel?: string;
A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint that accepts Sentry envelopes for forwarding. This can be used to force data through a custom server independent of the type of data.
interface Package
interface Package {}
JSDoc
interface Request
interface Request {}
Request data included in an event as sent to Sentry
interface RequestSession
interface RequestSession {}
property status
status?: RequestSessionStatus;
interface Response
interface Response {}
JSDoc
interface Runtime
interface Runtime {}
Runtime Context.
interface SamplingContext
interface SamplingContext extends CustomSamplingContext {}
Data passed to the
tracesSampler
function, which forms the basis for whatever decisions it might make.Adds default data to data provided by the user. See Hub.startTransaction
property location
location?: WorkerLocation;
Object representing the URL of the current page or worker script. Passed by default when using the
BrowserTracing
integration.
property parentSampled
parentSampled?: boolean;
Sampling decision from the parent transaction, if any.
property request
request?: ExtractedNodeRequestData;
Object representing the incoming request to a node server. Passed by default when using the TracingHandler.
property transactionContext
transactionContext: TransactionContext;
Context data with which transaction being sampled was created
interface Scope
interface Scope {}
Holds additional event information. Scope.applyToEvent will be called by the client before an event is sent.
method addBreadcrumb
addBreadcrumb: (breadcrumb: Breadcrumb, maxBreadcrumbs?: number) => this;
Sets the breadcrumbs in the scope
Parameter breadcrumbs
Breadcrumb
Parameter maxBreadcrumbs
number of max breadcrumbs to merged into event.
method addEventProcessor
addEventProcessor: (callback: EventProcessor) => this;
Add new event processor that will be called after applyToEvent.
method clear
clear: () => this;
Clears the current scope and resets its properties.
method clearBreadcrumbs
clearBreadcrumbs: () => this;
Clears all currently set Breadcrumbs.
method getRequestSession
getRequestSession: () => RequestSession | undefined;
Returns the
RequestSession
if there is one
method getSession
getSession: () => Session | undefined;
Returns the
Session
if there is one
method getSpan
getSpan: () => Span | undefined;
Returns the
Span
if there is one
method getTransaction
getTransaction: () => Transaction | undefined;
Returns the
Transaction
attached to the scope (if there is one)
method getUser
getUser: () => User | undefined;
Returns the
User
if there is one
method setContext
setContext: (name: string, context: Context | null) => this;
Sets context data with the given name.
Parameter name
of the context
Parameter context
an object containing context data. This data will be normalized. Pass
null
to unset the context.
method setExtra
setExtra: (key: string, extra: Extra) => this;
Set key:value that will be sent as extra data with the event.
Parameter key
String of extra
Parameter extra
Any kind of data. This data will be normalized.
method setExtras
setExtras: (extras: Extras) => this;
Set an object that will be merged sent as extra data with the event.
Parameter extras
Extras object to merge into current context.
method setFingerprint
setFingerprint: (fingerprint: string[]) => this;
Sets the fingerprint on the scope to send with the events.
Parameter fingerprint
string[] to group events in Sentry.
method setLevel
setLevel: (level: Severity) => this;
Sets the level on the scope for future events.
Parameter level
string Severity
method setRequestSession
setRequestSession: (requestSession?: RequestSession) => this;
Sets the
RequestSession
on the scope
method setSession
setSession: (session?: Session) => this;
Sets the
Session
on the scope
method setSpan
setSpan: (span?: Span) => this;
Sets the Span on the scope.
Parameter span
Span
method setTag
setTag: (key: string, value: Primitive) => this;
Set key:value that will be sent as tags data with the event.
Can also be used to unset a tag by passing
undefined
.Parameter key
String key of tag
Parameter value
Value of tag
method setTags
setTags: (tags: { [key: string]: Primitive }) => this;
Set an object that will be merged sent as tags data with the event.
Parameter tags
Tags context object to merge into current context.
method setTransactionName
setTransactionName: (name?: string) => this;
Sets the transaction name on the scope for future events.
method setUser
setUser: (user: User | null) => this;
Updates user context information for future events.
Parameter user
User context object to be set in the current context. Pass
null
to unset the user.
method update
update: (captureContext?: CaptureContext) => this;
Updates the scope with provided data. Can work in three variations: - plain object containing updatable attributes - Scope instance that'll extract the attributes from - callback function that'll receive the current scope as an argument and allow for modifications
Parameter captureContext
scope modifier to be used
interface ScopeContext
interface ScopeContext {}
JSDocs
property contexts
contexts: Contexts;
property extra
extra: Extras;
property fingerprint
fingerprint: string[];
property level
level: Severity;
property requestSession
requestSession: RequestSession;
property tags
tags: { [key: string]: Primitive;};
property user
user: User;
interface SdkInfo
interface SdkInfo {}
property integrations
integrations?: string[];
property name
name?: string;
property packages
packages?: Package[];
property version
version?: string;
interface SdkMetadata
interface SdkMetadata {}
property sdk
sdk?: SdkInfo;
interface SentryRequest
interface SentryRequest {}
A generic client request.
interface Session
interface Session extends SessionContext {}
method close
close: (status?: SessionStatus) => void;
JSDoc
method toJSON
toJSON: () => { init: boolean; sid: string; did?: string; timestamp: string; started: string; duration?: number; status: SessionStatus; errors: number; attrs?: { release?: string; environment?: string; user_agent?: string; ip_address?: string; };};
JSDoc
method update
update: (context?: SessionContext) => void;
JSDoc
interface SessionAggregates
interface SessionAggregates {}
JSDoc
property aggregates
aggregates: Array<AggregationCounts>;
property attrs
attrs?: { environment?: string; release?: string;};
interface SessionContext
interface SessionContext {}
Session Context
property did
did?: string;
property duration
duration?: number;
property environment
environment?: string;
property errors
errors?: number;
property ignoreDuration
ignoreDuration?: boolean;
property init
init?: boolean;
property ipAddress
ipAddress?: string;
property release
release?: string;
property sid
sid?: string;
property started
started?: number;
property status
status?: SessionStatus;
property timestamp
timestamp?: number;
property user
user?: User | null;
property userAgent
userAgent?: string;
interface SessionFlusherLike
interface SessionFlusherLike {}
method close
close: () => void;
Clears setInterval and calls flush
method flush
flush: () => void;
Empties Aggregate Buckets and Sends them to Transport Buffer
method incrementSessionStatusCount
incrementSessionStatusCount: () => void;
Increments the Session Status bucket in SessionAggregates Object corresponding to the status of the session captured
method sendSessionAggregates
sendSessionAggregates: (sessionAggregates: SessionAggregates) => void;
Submits the aggregates request mode sessions to Sentry
interface Span
interface Span extends SpanContext {}
Span holding trace_id, span_id
property data
data: { [key: string]: any;};
property spanId
spanId: string;
property startTimestamp
startTimestamp: number;
property tags
tags: { [key: string]: Primitive;};
property traceId
traceId: string;
property transaction
transaction?: Transaction;
The transaction containing this span
method child
child: ( spanContext?: Pick< SpanContext, Exclude< keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId' > >) => Span;
Use startChild
Deprecated
method finish
finish: (endTimestamp?: number) => void;
Sets the finish timestamp on the current span.
Parameter endTimestamp
Takes an endTimestamp if the end should not be the time when you call this function.
method getTraceContext
getTraceContext: () => { data?: { [key: string]: any }; description?: string; op?: string; parent_span_id?: string; span_id: string; status?: string; tags?: { [key: string]: Primitive }; trace_id: string;};
Convert the object to JSON for w. spans array info only
method isSuccess
isSuccess: () => boolean;
Determines whether span was successful (HTTP200)
method setData
setData: (key: string, value: any) => this;
Sets the data attribute on the current span
Parameter key
Data key
Parameter value
Data value
method setHttpStatus
setHttpStatus: (httpStatus: number) => this;
Sets the status attribute on the current span based on the http code
Parameter httpStatus
http code used to set the status
method setStatus
setStatus: (status: string) => this;
Sets the status attribute on the current span See: {@sentry/tracing SpanStatus} for possible values
Parameter status
http code used to set the status
method setTag
setTag: (key: string, value: Primitive) => this;
Sets the tag attribute on the current span.
Can also be used to unset a tag, by passing
undefined
.Parameter key
Tag key
Parameter value
Tag value
method startChild
startChild: ( spanContext?: Pick< SpanContext, Exclude< keyof SpanContext, 'spanId' | 'sampled' | 'traceId' | 'parentSpanId' > >) => Span;
Creates a new
Span
while setting the currentSpan.id
asparentSpanId
. Also thesampled
decision will be inherited.
method toContext
toContext: () => SpanContext;
Returns the current span properties as a
SpanContext
method toJSON
toJSON: () => { data?: { [key: string]: any }; description?: string; op?: string; parent_span_id?: string; span_id: string; start_timestamp: number; status?: string; tags?: { [key: string]: Primitive }; timestamp?: number; trace_id: string;};
Convert the object to JSON
method toTraceparent
toTraceparent: () => string;
Return a traceparent compatible header string
method updateWithContext
updateWithContext: (spanContext: SpanContext) => this;
Updates the current span with a new
SpanContext
interface SpanContext
interface SpanContext {}
Interface holding all properties that can be set on a Span on creation.
property data
data?: { [key: string]: any;};
Data of the Span.
property description
description?: string;
Description of the Span.
property endTimestamp
endTimestamp?: number;
Timestamp in seconds (epoch time) indicating when the span ended.
property op
op?: string;
Operation of the Span.
property parentSpanId
parentSpanId?: string;
Parent Span ID
property sampled
sampled?: boolean;
Was this span chosen to be sent as part of the sample?
property spanId
spanId?: string;
Span ID
property startTimestamp
startTimestamp?: number;
Timestamp in seconds (epoch time) indicating when the span started.
property status
status?: string;
Completion status of the Span. See: {@sentry/tracing SpanStatus} for possible values
property tags
tags?: { [key: string]: Primitive;};
Tags of the Span.
property traceId
traceId?: string;
Trace ID
interface StackFrame
interface StackFrame {}
JSDoc
property abs_path
abs_path?: string;
property addr_mode
addr_mode?: string;
property colno
colno?: number;
property context_line
context_line?: string;
property filename
filename?: string;
property function
function?: string;
property in_app
in_app?: boolean;
property instruction_addr
instruction_addr?: string;
property lineno
lineno?: number;
property module
module?: string;
property platform
platform?: string;
property post_context
post_context?: string[];
property pre_context
pre_context?: string[];
property vars
vars?: { [key: string]: any;};
interface Stacktrace
interface Stacktrace {}
JSDoc
property frames
frames?: StackFrame[];
property frames_omitted
frames_omitted?: [number, number];
interface Thread
interface Thread {}
JSDoc
property crashed
crashed?: boolean;
property current
current?: boolean;
property id
id?: number;
property name
name?: string;
property stacktrace
stacktrace?: Stacktrace;
interface Transaction
interface Transaction extends TransactionContext, Span {}
Transaction "Class", inherits Span only has
setName
property data
data: { [key: string]: any;};
property metadata
metadata: TransactionMetadata;
Metadata about the transaction
property spanId
spanId: string;
property startTimestamp
startTimestamp: number;
property tags
tags: { [key: string]: Primitive;};
property traceId
traceId: string;
method setName
setName: (name: string) => void;
Set the name of the transaction
method toContext
toContext: () => TransactionContext;
Returns the current transaction properties as a
TransactionContext
method updateWithContext
updateWithContext: (transactionContext: TransactionContext) => this;
Updates the current transaction with a new
TransactionContext
interface TransactionContext
interface TransactionContext extends SpanContext {}
Interface holding Transaction-specific properties
property metadata
metadata?: TransactionMetadata;
Metadata associated with the transaction, for internal SDK use.
property name
name: string;
Human-readable identifier for the transaction
property parentSampled
parentSampled?: boolean;
If this transaction has a parent, the parent's sampling decision
property trimEnd
trimEnd?: boolean;
If true, sets the end timestamp of the transaction to the highest timestamp of child spans, trimming the duration of the transaction. This is useful to discard extra time in the transaction that is not accounted for in child spans, like what happens in the idle transaction Tracing integration, where we finish the transaction after a given "idle time" and we don't want this "idle time" to be part of the transaction.
interface TransactionMetadata
interface TransactionMetadata {}
property requestPath
requestPath?: string;
For transactions tracing server-side request handling, the path of the request being tracked.
property tracestate
tracestate?: { sentry?: string; thirdparty?: string;};
The two halves (sentry and third-party) of a transaction's tracestate header, used for dynamic sampling
property transactionSampling
transactionSampling?: { rate?: number; method: TransactionSamplingMethod;};
interface Transport
interface Transport {}
Transport used sending data to Sentry
method close
close: (timeout?: number) => PromiseLike<boolean>;
Wait for all events to be sent or the timeout to expire, whichever comes first.
Parameter timeout
Maximum time in ms the transport should wait for events to be flushed. Omitting this parameter will cause the transport to wait until all events are sent before resolving the promise.
Returns
A promise that will resolve with
true
if all events are sent before the timeout, orfalse
if there are still events in the queue when the timeout is reached.
method recordLostEvent
recordLostEvent: (type: Outcome, category: SentryRequestType) => void;
Increment the counter for the specific client outcome
method sendEvent
sendEvent: (event: Event) => PromiseLike<Response>;
Sends the event to the Store endpoint in Sentry.
Parameter event
Event that should be sent to Sentry.
method sendSession
sendSession: (session: Session | SessionAggregates) => PromiseLike<Response>;
Sends the session to the Envelope endpoint in Sentry.
Parameter session
Session that should be sent to Sentry | Session Aggregates that should be sent to Sentry.
interface TransportOptions
interface TransportOptions {}
JSDoc
property caCerts
caCerts?: string;
HTTPS proxy certificates path
property dsn
dsn: DsnLike;
Sentry DSN
property fetchParameters
fetchParameters?: { [key: string]: string;};
Fetch API init parameters
property headers
headers?: { [key: string]: string;};
Define custom headers
property httpProxy
httpProxy?: string;
Set a HTTP proxy that should be used for outbound requests.
property httpsProxy
httpsProxy?: string;
Set a HTTPS proxy that should be used for outbound requests.
property sendClientReports
sendClientReports?: boolean;
Send SDK Client Reports. Enabled by default.
property tunnel
tunnel?: string;
The envelope tunnel to use.
interface User
interface User {}
JSDoc
property email
email?: string;
property id
id?: string;
property ip_address
ip_address?: string;
property username
username?: string;
index signature
[key: string]: any;
interface UserFeedback
interface UserFeedback {}
interface WorkerLocation
interface WorkerLocation {}
Location object on a service worker's
self
object.See https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation.
property hash
readonly hash: string;
The fragment identifier of the URL of the script executed in the Worker, beginning with a '#'.
property host
readonly host: string;
The host, that is the hostname, a ':', and the port of the URL of the script executed in the Worker.
property hostname
readonly hostname: string;
The domain of the URL of the script executed in the Worker.
property href
readonly href: string;
Stringifier that returns the whole URL of the script executed in the Worker.
property origin
readonly origin: string;
The canonical form of the origin of the specific location.
property pathname
readonly pathname: string;
The path of the URL of the script executed in the Worker, beginning with a '/'.
property port
readonly port: string;
The port number of the URL of the script executed in the Worker.
property protocol
readonly protocol: string;
The protocol scheme of the URL of the script executed in the Worker, including the final ':'.
property search
readonly search: string;
The parameters (query string) of the URL of the script executed in the Worker, beginning with a '?'.
method toString
toString: () => string;
Synonym for
href
attribute
interface WrappedFunction
interface WrappedFunction extends Function {}
JSDoc
index signature
[key: string]: any;
Enums
enum Severity
enum Severity { Fatal = 'fatal', Error = 'error', Warning = 'warning', Log = 'log', Info = 'info', Debug = 'debug', Critical = 'critical',}
TODO(v7): Remove this enum and replace with SeverityLevel
Type Aliases
type AttachmentItem
type AttachmentItem = BaseEnvelopeItem<AttachmentItemHeaders, unknown>;
type BaseEnvelopeHeaders
type BaseEnvelopeHeaders = { [key: string]: unknown; dsn?: string; sdk?: SdkInfo;};
type BaseEnvelopeItemHeaders
type BaseEnvelopeItemHeaders = { [key: string]: unknown; type: string; length?: number;};
type CaptureContext
type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);
JSDocs
type ClientReport
type ClientReport = { timestamp: number; discarded_events: Array<{ reason: Outcome; category: SentryRequestType; quantity: number; }>;};
type ClientReportEnvelope
type ClientReportEnvelope = BaseEnvelope< ClientReportEnvelopeHeaders, ClientReportItem>;
type ClientReportItem
type ClientReportItem = BaseEnvelopeItem<ClientReportItemHeaders, ClientReport>;
type Context
type Context = Record<string, unknown>;
type Contexts
type Contexts = Record<string, Context>;
type DebugImageType
type DebugImageType = 'wasm' | 'macho' | 'elf' | 'pe';
Possible choices for debug images.
type DsnLike
type DsnLike = string | DsnComponents;
Anything that can be parsed into a Dsn.
type DsnProtocol
type DsnProtocol = 'http' | 'https';
Supported Sentry transport protocols in a Dsn.
type Envelope
type Envelope = EventEnvelope | SessionEnvelope | ClientReportEnvelope;
type EventEnvelope
type EventEnvelope = BaseEnvelope< EventEnvelopeHeaders, EventItem | AttachmentItem | UserFeedbackItem>;
type EventItem
type EventItem = BaseEnvelopeItem<EventItemHeaders, Event | string>;
type EventProcessor
type EventProcessor = ( event: Event, hint?: EventHint) => PromiseLike<Event | null> | Event | null;
Event processors are used to change the event before it will be send. We strongly advise to make this function sync. Returning a PromiseLike<Event | null> will work just fine, but better be sure that you know what you are doing. Event processing will be deferred until your Promise is resolved.
type EventStatus
type EventStatus = /** The status could not be determined. */ | 'unknown' /** The event was skipped due to configuration or callbacks. */ | 'skipped' /** The event was sent to Sentry successfully. */ | 'rate_limit' /** The client is currently rate limited and will try again later. */ | 'invalid' /** The event could not be processed. */ | 'failed' /** A server-side error occurred during submission. */ | 'success';
type Extra
type Extra = unknown;
type Extras
type Extras = Record<string, Extra>;
type Measurements
type Measurements = Record< string, { value: number; }>;
type Outcome
type Outcome = | 'before_send' | 'event_processor' | 'network_error' | 'queue_overflow' | 'ratelimit_backoff' | 'sample_rate';
type Primitive
type Primitive = number | string | boolean | bigint | symbol | null | undefined;
type QueryParams
type QueryParams = | string | { [key: string]: string; } | Array<[string, string]>;
type RequestSessionStatus
type RequestSessionStatus = 'ok' | 'errored' | 'crashed';
type SentryRequestType
type SentryRequestType = 'event' | 'transaction' | 'session' | 'attachment';
Possible SentryRequest types that can be used to make a distinction between Sentry features
type SessionEnvelope
type SessionEnvelope = BaseEnvelope<SessionEnvelopeHeaders, SessionItem>;
type SessionItem
type SessionItem = | BaseEnvelopeItem<SessionItemHeaders, Session> | BaseEnvelopeItem<SessionAggregatesItemHeaders, SessionAggregates>;
type SessionStatus
type SessionStatus = 'ok' | 'exited' | 'crashed' | 'abnormal';
type SeverityLevel
type SeverityLevel = typeof SeverityLevels[number];
type TraceparentData
type TraceparentData = Pick< TransactionContext, 'traceId' | 'parentSpanId' | 'parentSampled'>;
Data pulled from a
sentry-trace
header
type TransactionSamplingMethod
type TransactionSamplingMethod = | 'explicitly_set' | 'client_sampler' | 'client_rate' | 'inheritance';
type TransportClass
type TransportClass<T extends Transport> = new (options: TransportOptions) => T;
JSDoc
type UserFeedbackItem
type UserFeedbackItem = BaseEnvelopeItem<UserFeedbackItemHeaders, UserFeedback>;
Package Files (36)
- types/breadcrumb.d.ts
- types/client.d.ts
- types/clientreport.d.ts
- types/context.d.ts
- types/debugMeta.d.ts
- types/dsn.d.ts
- types/envelope.d.ts
- types/error.d.ts
- types/event.d.ts
- types/eventprocessor.d.ts
- types/eventstatus.d.ts
- types/exception.d.ts
- types/extra.d.ts
- types/hub.d.ts
- types/index.d.ts
- types/integration.d.ts
- types/mechanism.d.ts
- types/misc.d.ts
- types/options.d.ts
- types/package.d.ts
- types/request.d.ts
- types/response.d.ts
- types/runtime.d.ts
- types/scope.d.ts
- types/sdkinfo.d.ts
- types/sdkmetadata.d.ts
- types/session.d.ts
- types/severity.d.ts
- types/span.d.ts
- types/stackframe.d.ts
- types/stacktrace.d.ts
- types/thread.d.ts
- types/transaction.d.ts
- types/transport.d.ts
- types/user.d.ts
- types/wrappedfunction.d.ts
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@sentry/types
.
- Markdown[](https://www.jsdocs.io/package/@sentry/types)
- HTML<a href="https://www.jsdocs.io/package/@sentry/types"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7104 ms. - Missing or incorrect documentation? Open an issue for this package.