@devmoods/express-extras 0.65.0 → 0.65.1

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/dist/config.d.ts CHANGED
@@ -14,6 +14,9 @@ declare const app: import("@devmoods/config").Defs<{
14
14
  REDIS_URL: string;
15
15
  REDIS_KEY_PREFIX: string;
16
16
  SENTRY_DSN: string;
17
+ SENTRY_TRACES_SAMPLE_RATE: number;
18
+ SENTRY_PROFILES_SAMPLE_RATE: number;
19
+ SENTRY_EVENT_LOOP_THRESHOLD: number;
17
20
  LOG_LEVEL: string;
18
21
  LOG_SQL: boolean;
19
22
  NODE_ENV: string;
@@ -43,6 +46,9 @@ export declare const config: import("@devmoods/config").Defs<{
43
46
  REDIS_URL: string;
44
47
  REDIS_KEY_PREFIX: string;
45
48
  SENTRY_DSN: string;
49
+ SENTRY_TRACES_SAMPLE_RATE: number;
50
+ SENTRY_PROFILES_SAMPLE_RATE: number;
51
+ SENTRY_EVENT_LOOP_THRESHOLD: number;
46
52
  LOG_LEVEL: string;
47
53
  LOG_SQL: boolean;
48
54
  NODE_ENV: string;
package/dist/config.js CHANGED
@@ -12,6 +12,9 @@ const app = define({
12
12
  REDIS_URL: t.string(),
13
13
  REDIS_KEY_PREFIX: t.string(),
14
14
  SENTRY_DSN: t.string(),
15
+ SENTRY_TRACES_SAMPLE_RATE: t.number(0.3),
16
+ SENTRY_PROFILES_SAMPLE_RATE: t.number(0.3),
17
+ SENTRY_EVENT_LOOP_THRESHOLD: t.number(300),
15
18
  LOG_LEVEL: t.string(),
16
19
  LOG_SQL: t.boolean(),
17
20
  NODE_ENV: t.string(),
package/dist/context.d.ts CHANGED
@@ -18,6 +18,10 @@ export declare function useRequestContext<T>(key: string): T | undefined;
18
18
  * Set a value on the request context
19
19
  */
20
20
  export declare function setRequestContext<T>(key: string, value: T): void;
21
+ export declare function useRequestCounter(key: string): {
22
+ value: number;
23
+ increase: () => void;
24
+ };
21
25
  /**
22
26
  * Obtain the requestId from the current async request context.
23
27
  */
package/dist/context.js CHANGED
@@ -34,6 +34,14 @@ export function setRequestContext(key, value) {
34
34
  store.set(key, value);
35
35
  }
36
36
  }
37
+ export function useRequestCounter(key) {
38
+ const value = useRequestContext(key) || 0;
39
+ const increase = () => setRequestContext(key, value + 1);
40
+ return {
41
+ value,
42
+ increase,
43
+ };
44
+ }
37
45
  /**
38
46
  * Obtain the requestId from the current async request context.
39
47
  */
package/dist/sentry.js CHANGED
@@ -4,11 +4,13 @@ import { nodeProfilingIntegration } from '@sentry/profiling-node';
4
4
  export function sentryOptions(options = {}) {
5
5
  return {
6
6
  dsn: config.SENTRY_DSN,
7
- tracesSampleRate: 1.0,
8
- profilesSampleRate: 1.0,
7
+ tracesSampleRate: config.SENTRY_TRACES_SAMPLE_RATE,
8
+ profilesSampleRate: config.SENTRY_PROFILES_SAMPLE_RATE,
9
9
  integrations: [
10
10
  nodeProfilingIntegration(),
11
- eventLoopBlockIntegration({ threshold: 300 }),
11
+ eventLoopBlockIntegration({
12
+ threshold: config.SENTRY_EVENT_LOOP_THRESHOLD,
13
+ }),
12
14
  ],
13
15
  enableLogs: true,
14
16
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devmoods/express-extras",
3
- "version": "0.65.0",
3
+ "version": "0.65.1",
4
4
  "description": "Kubernetes-ready utilities for rapid Node.js application development",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -114,5 +114,5 @@
114
114
  "engines": {
115
115
  "node": ">=20 <25"
116
116
  },
117
- "gitHead": "600a2c41cd71ae45a5fc01058b84eeeb48be63b1"
117
+ "gitHead": "916426bf70f924d62e9dfaccbb22145d41eece28"
118
118
  }