utilitas 1995.2.89 → 1995.2.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.89",
4
+ "version": "1995.2.91",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -36,6 +36,7 @@ const manifest = {
36
36
  "@mozilla/readability": "^0.5.0",
37
37
  "@ngrok/ngrok": "^1.1.1",
38
38
  "@sentry/node": "^7.106.0",
39
+ "@sentry/profiling-node": "^7.106.0",
39
40
  "acme-client": "^5.3.0",
40
41
  "browserify-fs": "^1.0.0",
41
42
  "buffer": "^6.0.3",
package/lib/sentinel.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isPrimary } from './callosum.mjs';
2
2
  import { log as _log, need } from './utilitas.mjs';
3
3
 
4
- const _NEED = ['@sentry/node'];
4
+ const _NEED = ['@sentry/node', '@sentry/profiling-node'];
5
5
  const log = (content) => _log(content, import.meta.url);
6
6
 
7
7
  let sentry;
@@ -9,12 +9,21 @@ let sentry;
9
9
  const init = async (options) => {
10
10
  if (options) {
11
11
  sentry = await need('@sentry/node');
12
+ const integrations = [
13
+ sentry.onUnhandledRejectionIntegration({ mode: 'strict' }),
14
+ ...sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
15
+ ...options?.integrations || [],
16
+ ];
17
+ try {
18
+ // https://docs.sentry.io/platforms/node/profiling/
19
+ const { nodeProfilingIntegration } = await need(
20
+ '@sentry/profiling-node', { raw: true }
21
+ );
22
+ integrations.push(nodeProfilingIntegration());
23
+ } catch (e) { log('Sentry Profiling is not available.'); }
12
24
  sentry.init({
13
- debug: globalThis.debug, ...options || {},
14
- integrations: [
15
- new sentry.Integrations.OnUnhandledRejection({ mode: 'strict' }),
16
- ...options?.integrations || [],
17
- ],
25
+ tracesSampleRate: 1.0, profilesSampleRate: 1.0,
26
+ debug: globalThis.debug, ...options || {}, integrations,
18
27
  });
19
28
  isPrimary && !options.silent && log(`Initialized, dsn: ${options.dsn}.`);
20
29
  }
@@ -27,3 +36,14 @@ export {
27
36
  _NEED,
28
37
  init,
29
38
  };
39
+
40
+ // Demo:
41
+ // (await utilitas.sentinel.init()).startSpan(
42
+ // {
43
+ // op: "rootSpan",
44
+ // name: "My root span",
45
+ // },
46
+ // async () => {
47
+ // // This function is the span's operation
48
+ // }
49
+ // );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.89",
4
+ "version": "1995.2.91",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -47,6 +47,7 @@
47
47
  "@mozilla/readability": "^0.5.0",
48
48
  "@ngrok/ngrok": "^1.1.1",
49
49
  "@sentry/node": "^7.106.0",
50
+ "@sentry/profiling-node": "^7.106.0",
50
51
  "acme-client": "^5.3.0",
51
52
  "browserify-fs": "^1.0.0",
52
53
  "buffer": "^6.0.3",