1 | const sender = require('./service/sendRaw');
|
2 |
|
3 | /**
|
4 | *
|
5 | * @param {*} monitorSlug Required
|
6 | * @param {*} dsn If not set will read from environment SENTRY_DSN
|
7 | * @param {*} environment If not set will read from the environment SENTRY_ENV
|
8 | * @param {*} release If not set will read from the environment GIT_SHA
|
9 | * @returns function
|
10 | */
|
11 | module.exports = (monitorSlug, dsn, environment, release) => {
|
12 | let checkInId;
|
13 |
|
14 | return {
|
15 | start: () => {
|
16 | checkInId = sender(monitorSlug, dsn, environment, release, 'in_progress');
|
17 | },
|
18 | completed: async () => {
|
19 | await sender(monitorSlug, dsn, environment, release, 'ok', await checkInId);
|
20 | },
|
21 | error: async () => {
|
22 | await sender(monitorSlug, dsn, environment, release, 'error', await checkInId);
|
23 | }
|
24 | };
|
25 | };
|