@djangocfg/monitor 2.1.230 → 2.1.232

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.
@@ -1,6 +1,7 @@
1
1
  import { createStore } from 'zustand/vanilla'
2
2
  import type { MonitorEvent, MonitorConfig } from '../../types'
3
3
  import { sendBatch } from '../transport/ingest'
4
+ import { MONITOR_VERSION } from '../utils/env'
4
5
 
5
6
  // Circuit breaker: pause flushing after N consecutive transport failures
6
7
  const CIRCUIT_BREAKER_THRESHOLD = 3
@@ -28,6 +29,7 @@ export const monitorStore = createStore<MonitorState>((set, get) => ({
28
29
  const { config, buffer } = get()
29
30
  const maxSize = config.maxBufferSize ?? 20
30
31
  const sanitized: MonitorEvent = {
32
+ build_id: event.build_id ?? config.buildId ?? `sdk:${MONITOR_VERSION}`,
31
33
  ...event,
32
34
  // Enforce field size limits before buffering (last-resort backstop)
33
35
  message: event.message && event.message.length > 4997
@@ -11,3 +11,6 @@ export const isDevelopment = process.env.NODE_ENV === 'development'
11
11
 
12
12
  /** True in production builds and test environments */
13
13
  export const isProduction = process.env.NODE_ENV !== 'development'
14
+
15
+ /** Package version — injected at build time via tsup define, falls back to package.json value */
16
+ export const MONITOR_VERSION: string = (process.env.MONITOR_VERSION as string) ?? '2.1.230'
@@ -16,6 +16,7 @@
16
16
  import { monitorStore } from './store'
17
17
  import { EventType, EventLevel } from '../_api'
18
18
  import { getSessionId } from './capture/session'
19
+ import { MONITOR_VERSION } from './utils/env'
19
20
  import type { MonitorEvent } from '../types'
20
21
 
21
22
  export interface WindowMonitorAPI {
@@ -105,6 +106,8 @@ export function initWindowMonitor(): void {
105
106
  status() {
106
107
  const state = monitorStore.getState()
107
108
  console.group('[monitor] status')
109
+ console.log('sdk version:', MONITOR_VERSION)
110
+ console.log('build_id:', state.config.buildId ?? `sdk:${MONITOR_VERSION}`)
108
111
  console.log('config:', state.config)
109
112
  console.log('buffer size:', state.buffer.length)
110
113
  console.log('initialized:', state.initialized)