@brizz/sdk 0.1.5 → 0.1.7

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/index.d.cts CHANGED
@@ -117,6 +117,12 @@ declare function emitEvent(name: string, attributes?: Record<string, string | nu
117
117
  declare function getSpanExporter(): SpanExporter;
118
118
  declare function getSpanProcessor(): SpanProcessor;
119
119
 
120
+ declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
121
+ [name: string]: string;
122
+ }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
123
+ declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
124
+ [name: string]: string;
125
+ }, fn: F, thisArg?: ThisParameterType<F>): F;
120
126
  declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>): F;
121
127
  declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
122
128
 
@@ -136,4 +142,4 @@ declare namespace init {
136
142
  export { };
137
143
  }
138
144
 
139
- export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, callWithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel, withSessionId };
145
+ export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, callWithProperties, callWithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel, withProperties, withSessionId };
package/dist/index.d.ts CHANGED
@@ -117,6 +117,12 @@ declare function emitEvent(name: string, attributes?: Record<string, string | nu
117
117
  declare function getSpanExporter(): SpanExporter;
118
118
  declare function getSpanProcessor(): SpanProcessor;
119
119
 
120
+ declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
121
+ [name: string]: string;
122
+ }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
123
+ declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
124
+ [name: string]: string;
125
+ }, fn: F, thisArg?: ThisParameterType<F>): F;
120
126
  declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>): F;
121
127
  declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
122
128
 
@@ -136,4 +142,4 @@ declare namespace init {
136
142
  export { };
137
143
  }
138
144
 
139
- export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, callWithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel, withSessionId };
145
+ export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMaskingConfig, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, callWithProperties, callWithSessionId, detectRuntime, emitEvent, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, setLogLevel, withProperties, withSessionId };
package/dist/index.js CHANGED
@@ -314,6 +314,11 @@ function resolveConfig(options) {
314
314
  return resolvedConfig;
315
315
  }
316
316
 
317
+ // src/internal/constants.ts
318
+ var BRIZZ_SDK_VERSION = "brizz.sdk.version";
319
+ var BRIZZ_SDK_LANGUAGE = "brizz.sdk.language";
320
+ var SDK_LANGUAGE = "typescript";
321
+
317
322
  // src/internal/instrumentation/registry.ts
318
323
  import { AnthropicInstrumentation as AnthropicInstrumentation2 } from "@traceloop/instrumentation-anthropic";
319
324
  import { BedrockInstrumentation as BedrockInstrumentation2 } from "@traceloop/instrumentation-bedrock";
@@ -427,6 +432,11 @@ import {
427
432
  LoggerProvider
428
433
  } from "@opentelemetry/sdk-logs";
429
434
 
435
+ // src/internal/version.ts
436
+ function getSDKVersion() {
437
+ return "0.1.7";
438
+ }
439
+
430
440
  // src/internal/log/processors/log-processor.ts
431
441
  import { context } from "@opentelemetry/api";
432
442
  import { BatchLogRecordProcessor, SimpleLogRecordProcessor } from "@opentelemetry/sdk-logs";
@@ -1224,7 +1234,9 @@ var LoggingModule = class _LoggingModule {
1224
1234
  serviceName: config.appName
1225
1235
  });
1226
1236
  const resourceAttributes = {
1227
- "service.name": config.appName
1237
+ "service.name": config.appName,
1238
+ [BRIZZ_SDK_VERSION]: getSDKVersion(),
1239
+ [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1228
1240
  };
1229
1241
  if (config.environment) {
1230
1242
  resourceAttributes["deployment.environment"] = config.environment;
@@ -1617,26 +1629,28 @@ function getSpanProcessor() {
1617
1629
 
1618
1630
  // src/internal/trace/session.ts
1619
1631
  import { context as context3 } from "@opentelemetry/api";
1620
- function withProperties(properties, fn, thisArg, ...args) {
1621
- if (Object.keys(properties).length === 0) {
1622
- return fn.apply(thisArg, args);
1623
- }
1624
- const newContext = context3.active().setValue(PROPERTIES_CONTEXT_KEY, properties);
1625
- return context3.with(newContext, fn, thisArg, ...args);
1632
+ function callWithProperties(properties, fn, thisArg, ...args) {
1633
+ const base = context3.active();
1634
+ const prev = base.getValue(PROPERTIES_CONTEXT_KEY);
1635
+ const merged = prev ? { ...prev, ...properties } : properties;
1636
+ const next = base.setValue(PROPERTIES_CONTEXT_KEY, merged);
1637
+ return context3.with(next, fn, thisArg, ...args);
1626
1638
  }
1627
- function withSessionId(sessionId, fn, thisArg) {
1639
+ function withProperties(properties, fn, thisArg) {
1628
1640
  return function wrapped(...args) {
1629
- const base = context3.active();
1630
- const prev = base.getValue(PROPERTIES_CONTEXT_KEY);
1631
- const next = base.setValue(
1632
- PROPERTIES_CONTEXT_KEY,
1633
- prev ? { ...prev, [SESSION_ID]: sessionId } : { [SESSION_ID]: sessionId }
1641
+ return callWithProperties(
1642
+ properties,
1643
+ fn,
1644
+ thisArg !== void 0 ? thisArg : this,
1645
+ ...args
1634
1646
  );
1635
- return context3.with(next, fn, thisArg ?? this, ...args);
1636
1647
  };
1637
1648
  }
1649
+ function withSessionId(sessionId, fn, thisArg) {
1650
+ return withProperties({ [SESSION_ID]: sessionId }, fn, thisArg);
1651
+ }
1638
1652
  function callWithSessionId(sessionId, fn, thisArg, ...args) {
1639
- return withProperties({ [SESSION_ID]: sessionId }, fn, thisArg, ...args);
1653
+ return callWithProperties({ [SESSION_ID]: sessionId }, fn, thisArg, ...args);
1640
1654
  }
1641
1655
 
1642
1656
  // src/internal/sdk.ts
@@ -1710,7 +1724,9 @@ var _Brizz = class __Brizz {
1710
1724
  const registry = InstrumentationRegistry.getInstance();
1711
1725
  const manualInstrumentations = registry.getManualInstrumentations();
1712
1726
  const resourceAttributes = {
1713
- "service.name": resolvedConfig.appName
1727
+ "service.name": resolvedConfig.appName,
1728
+ [BRIZZ_SDK_VERSION]: getSDKVersion(),
1729
+ [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1714
1730
  };
1715
1731
  if (resolvedConfig.environment) {
1716
1732
  resourceAttributes["deployment.environment"] = resolvedConfig.environment;
@@ -1886,6 +1902,7 @@ export {
1886
1902
  DEFAULT_PII_PATTERNS,
1887
1903
  LogLevel,
1888
1904
  SeverityNumber2 as SeverityNumber,
1905
+ callWithProperties,
1889
1906
  callWithSessionId,
1890
1907
  detectRuntime,
1891
1908
  emitEvent,
@@ -1899,6 +1916,7 @@ export {
1899
1916
  maskAttributes,
1900
1917
  maskValue,
1901
1918
  setLogLevel,
1919
+ withProperties,
1902
1920
  withSessionId
1903
1921
  };
1904
1922
  //# sourceMappingURL=index.js.map