Skip to content

Commit 070e8fb

Browse files
committed
Add breadcrumbCallback, sampleRate config opts to d.ts
1 parent 4e12341 commit 070e8fb

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

typescript/raven-tests.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Raven, {RavenOutgoingData} from "./raven"
1+
import Raven, {RavenOutgoingData, RavenBreadcrumb} from "./raven"
22

33
// configuring:
44
Raven.config('https://public@getsentry.com/1').install();
@@ -16,7 +16,8 @@ Raven.config(
1616
includePaths: [
1717
/https?:\/\/(www\.)?getsentry\.com/,
1818
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
19-
]
19+
],
20+
sampleRate: 0.5
2021
}
2122
).install();
2223

@@ -26,6 +27,8 @@ Raven.setDataCallback(function (data: RavenOutgoingData, original: string) {retu
2627
Raven.setShouldSendCallback((data: RavenOutgoingData) => {return data});
2728
Raven.setShouldSendCallback(function (data: RavenOutgoingData, original: string) {return data});
2829

30+
Raven.setBreadcrumbCallback(function (crumb: RavenBreadcrumb) {return crumb;});
31+
Raven.setBreadcrumbCallback(function (crumb: RavenBreadcrumb) {return false;});
2932

3033
// context:
3134
Raven.context(throwsError);

typescript/raven.d.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ interface RavenStatic {
5353
addPlugin(plugin: RavenPlugin, ...pluginArgs: any[]): RavenStatic;
5454

5555
/**
56-
* Wrap code within a context so Raven can capture errors reliably across domains that is
56+
* Wrap code within a context so Raven can capture errors reliably across domains that is
5757
* executed immediately.
5858
*
5959
* @param options A specific set of options for this context
@@ -96,7 +96,7 @@ interface RavenStatic {
9696
*/
9797
captureMessage(msg: string, options?: RavenOptions): RavenStatic;
9898

99-
/**
99+
/**
100100
* Add a breadcrumb
101101
* @param crumb The trail which should be added to the trail
102102
*/
@@ -114,29 +114,29 @@ interface RavenStatic {
114114
*/
115115
setUserContext(): RavenStatic;
116116

117-
/**
117+
/**
118118
* Add arbitrary data to be sent along with the payload.
119119
* @param extra data of an arbitrary, nested type which will be added
120120
*/
121121
setExtraContext(extra: { [prop: string]: any }): RavenStatic;
122122

123-
/**
123+
/**
124124
* Add additional tags to be sent along with payloads.
125125
* @param tags A key/value-pair which will be added
126126
*/
127127
setTagsContext(tags: { [id: string]: string }): RavenStatic;
128128

129-
/**
129+
/**
130130
* Clear the whole currently set context.
131131
*/
132132
clearContext(): RavenStatic;
133133

134-
/**
134+
/**
135135
* Get a copy of the current context.
136136
*/
137137
getContext(): Object;
138138

139-
/**
139+
/**
140140
* Set environment of application
141141
* @param environment Typically something like 'production'
142142
*/
@@ -148,7 +148,7 @@ interface RavenStatic {
148148
*/
149149
setRelease(release: string): RavenStatic;
150150

151-
/**
151+
/**
152152
* Specify a callback function that can mutate or filter breadcrumbs when they are captured.
153153
* @param callback The function which applies the filter
154154
*/
@@ -182,7 +182,7 @@ interface RavenStatic {
182182
*/
183183
lastEventId(): string;
184184

185-
/**
185+
/**
186186
* Determine if Raven is setup and ready to go.
187187
*/
188188
isSetup(): boolean;
@@ -237,8 +237,8 @@ export interface RavenOptions extends CommonRavenOptions {
237237
/** The log level associated with this event. Default: error */
238238
level?: string;
239239

240-
/** In some cases you may see issues where Sentry groups multiple events together when they
241-
* should be separate entities. In other cases, Sentry simply doesn’t group events together
240+
/** In some cases you may see issues where Sentry groups multiple events together when they
241+
* should be separate entities. In other cases, Sentry simply doesn’t group events together
242242
* because they’re so sporadic that they never look the same. */
243243
fingerprint?: string[];
244244

@@ -288,6 +288,12 @@ export interface RavenGlobalOptions extends CommonRavenOptions {
288288

289289
/** A function which allows mutation of the data payload right before being sent to Sentry */
290290
dataCallback?: (data: RavenOutgoingData) => RavenOutgoingData;
291+
292+
/** A function that allows filtering or mutating breadcrumb payloads. Return false to throw away the breadcrumb. */
293+
breadcrumbCallback?: (data: RavenBreadcrumb) => RavenBreadcrumb;
294+
295+
/** A sampling rate to apply to events. A value of 0.0 will send no events, and a value of 1.0 will send all events (default). */
296+
sampleRate?: number;
291297
}
292298

293299
export interface RavenWrapOptions extends RavenOptions {

0 commit comments

Comments
 (0)