langwatch 0.3.1 → 0.4.0

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.
Files changed (203) hide show
  1. package/README.md +5 -2
  2. package/dist/{add-LBBS4I3H.js → add-35QACTIV.js} +34 -28
  3. package/dist/add-35QACTIV.js.map +1 -0
  4. package/dist/{add-RD3ZKFAT.mjs → add-TRJAXM4D.mjs} +22 -16
  5. package/dist/add-TRJAXM4D.mjs.map +1 -0
  6. package/dist/chunk-4ZSSHX6F.js +636 -0
  7. package/dist/chunk-4ZSSHX6F.js.map +1 -0
  8. package/dist/chunk-5EVBOHJY.js +155 -0
  9. package/dist/chunk-5EVBOHJY.js.map +1 -0
  10. package/dist/{chunk-YN4436PK.mjs → chunk-CU3443HD.mjs} +14 -9
  11. package/dist/{chunk-2JU376G7.js → chunk-D2CSG4SJ.js} +4 -4
  12. package/dist/chunk-D2CSG4SJ.js.map +1 -0
  13. package/dist/chunk-DISMHYXC.js +184 -0
  14. package/dist/chunk-DISMHYXC.js.map +1 -0
  15. package/dist/{chunk-E7UE2MPD.mjs → chunk-ECUXLXFT.mjs} +2 -2
  16. package/dist/chunk-EJWJXTPU.mjs +626 -0
  17. package/dist/chunk-EJWJXTPU.mjs.map +1 -0
  18. package/dist/chunk-GQMDZ4GY.mjs +155 -0
  19. package/dist/chunk-GQMDZ4GY.mjs.map +1 -0
  20. package/dist/{chunk-3GKPQB4R.mjs → chunk-HUI45ULC.mjs} +4 -4
  21. package/dist/chunk-HUI45ULC.mjs.map +1 -0
  22. package/dist/{chunk-HJU67C7H.js → chunk-K64Y6YUG.js} +10 -10
  23. package/dist/{chunk-HJU67C7H.js.map → chunk-K64Y6YUG.js.map} +1 -1
  24. package/dist/chunk-LP76VXI3.mjs +636 -0
  25. package/dist/chunk-LP76VXI3.mjs.map +1 -0
  26. package/dist/chunk-M4VUHTT2.js +626 -0
  27. package/dist/chunk-M4VUHTT2.js.map +1 -0
  28. package/dist/{chunk-PR3JDWC3.mjs → chunk-N2V6J3U2.mjs} +28 -3
  29. package/dist/chunk-N2V6J3U2.mjs.map +1 -0
  30. package/dist/chunk-OUCVXP4G.js +258 -0
  31. package/dist/chunk-OUCVXP4G.js.map +1 -0
  32. package/dist/{chunk-FJLK5CFL.js → chunk-OXBO24RB.js} +13 -8
  33. package/dist/chunk-OXBO24RB.js.map +1 -0
  34. package/dist/chunk-PGWR3OQY.mjs +258 -0
  35. package/dist/chunk-PGWR3OQY.mjs.map +1 -0
  36. package/dist/{chunk-SMXXAVMB.js → chunk-SGNJDRCT.js} +2 -2
  37. package/dist/chunk-SGNJDRCT.js.map +1 -0
  38. package/dist/{chunk-W5ZEP3CI.mjs → chunk-SYMZPWZE.mjs} +2 -2
  39. package/dist/chunk-SYMZPWZE.mjs.map +1 -0
  40. package/dist/{chunk-KGDAENGD.js → chunk-YH5TIVK2.js} +28 -3
  41. package/dist/chunk-YH5TIVK2.js.map +1 -0
  42. package/dist/chunk-YNQ44U6D.mjs +184 -0
  43. package/dist/chunk-YNQ44U6D.mjs.map +1 -0
  44. package/dist/cli/index.js +8 -8
  45. package/dist/cli/index.mjs +8 -8
  46. package/dist/{create-G5MTGOOH.js → create-7K2CC4KQ.js} +11 -11
  47. package/dist/{create-G5MTGOOH.js.map → create-7K2CC4KQ.js.map} +1 -1
  48. package/dist/{create-QUZYBMQB.mjs → create-MK7NEGCM.mjs} +8 -8
  49. package/dist/implementation-C4lvooSg.d.mts +576 -0
  50. package/dist/implementation-CzemP9jY.d.ts +576 -0
  51. package/dist/index-DTEZr0Jn.d.mts +34 -0
  52. package/dist/index-DTEZr0Jn.d.ts +34 -0
  53. package/dist/index.d.mts +122 -41
  54. package/dist/index.d.ts +122 -41
  55. package/dist/index.js +16 -12
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +27 -23
  58. package/dist/index.mjs.map +1 -1
  59. package/dist/init-GDKJICSS.js +16 -0
  60. package/dist/{init-XU2JFY6N.js.map → init-GDKJICSS.js.map} +1 -1
  61. package/dist/{init-H67RW22E.mjs → init-RINSTP4L.mjs} +5 -5
  62. package/dist/{list-7NPSX2E4.mjs → list-7L23G5DY.mjs} +28 -16
  63. package/dist/list-7L23G5DY.mjs.map +1 -0
  64. package/dist/{list-ZXFLAF52.js → list-OLLQ7XKZ.js} +29 -17
  65. package/dist/list-OLLQ7XKZ.js.map +1 -0
  66. package/dist/{login-EK4WVOI2.mjs → login-RCNKL5AM.mjs} +6 -5
  67. package/dist/login-RCNKL5AM.mjs.map +1 -0
  68. package/dist/{login-76NQIHKR.js → login-XF3BQQPV.js} +7 -6
  69. package/dist/login-XF3BQQPV.js.map +1 -0
  70. package/dist/observability-sdk/index.d.mts +134 -0
  71. package/dist/observability-sdk/index.d.ts +134 -0
  72. package/dist/observability-sdk/index.js +41 -0
  73. package/dist/observability-sdk/index.js.map +1 -0
  74. package/dist/observability-sdk/index.mjs +41 -0
  75. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +69 -0
  76. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +69 -0
  77. package/dist/observability-sdk/instrumentation/langchain/index.js +518 -0
  78. package/dist/observability-sdk/instrumentation/langchain/index.js.map +1 -0
  79. package/dist/observability-sdk/instrumentation/langchain/index.mjs +518 -0
  80. package/dist/observability-sdk/instrumentation/langchain/index.mjs.map +1 -0
  81. package/dist/observability-sdk/setup/node/index.d.mts +368 -0
  82. package/dist/observability-sdk/setup/node/index.d.ts +368 -0
  83. package/dist/observability-sdk/setup/node/index.js +276 -0
  84. package/dist/observability-sdk/setup/node/index.js.map +1 -0
  85. package/dist/observability-sdk/setup/node/index.mjs +276 -0
  86. package/dist/observability-sdk/setup/node/index.mjs.map +1 -0
  87. package/dist/{remove-SDJYEPAY.mjs → remove-3VLQNVHN.mjs} +11 -8
  88. package/dist/remove-3VLQNVHN.mjs.map +1 -0
  89. package/dist/{remove-XBNGIVMR.js → remove-L6JVJBWY.js} +18 -15
  90. package/dist/remove-L6JVJBWY.js.map +1 -0
  91. package/dist/{sync-ST2IWXSB.mjs → sync-DPMTUTVL.mjs} +39 -33
  92. package/dist/sync-DPMTUTVL.mjs.map +1 -0
  93. package/dist/{sync-EISKGPTL.js → sync-PSU3F5Z4.js} +52 -46
  94. package/dist/sync-PSU3F5Z4.js.map +1 -0
  95. package/dist/{prompt-D-jpMrLS.d.mts → types-1q5wIYP5.d.mts} +628 -14
  96. package/dist/{prompt-D-jpMrLS.d.ts → types-C9k5gGhU.d.ts} +628 -14
  97. package/dist/types-DRiQaKFG.d.mts +254 -0
  98. package/dist/types-DRiQaKFG.d.ts +254 -0
  99. package/dist/types-Dmazk5Bk.d.mts +44 -0
  100. package/dist/types-Dmazk5Bk.d.ts +44 -0
  101. package/package.json +40 -40
  102. package/dist/add-LBBS4I3H.js.map +0 -1
  103. package/dist/add-RD3ZKFAT.mjs.map +0 -1
  104. package/dist/chunk-2JU376G7.js.map +0 -1
  105. package/dist/chunk-2ODBGSBI.js +0 -4
  106. package/dist/chunk-2ODBGSBI.js.map +0 -1
  107. package/dist/chunk-3GKPQB4R.mjs.map +0 -1
  108. package/dist/chunk-52GXX3MA.js +0 -426
  109. package/dist/chunk-52GXX3MA.js.map +0 -1
  110. package/dist/chunk-5NC5ILKA.js +0 -94
  111. package/dist/chunk-5NC5ILKA.js.map +0 -1
  112. package/dist/chunk-6I4EA43Y.js +0 -39
  113. package/dist/chunk-6I4EA43Y.js.map +0 -1
  114. package/dist/chunk-DTEKFQ4U.js +0 -159
  115. package/dist/chunk-DTEKFQ4U.js.map +0 -1
  116. package/dist/chunk-F63YKTXA.mjs +0 -47
  117. package/dist/chunk-F63YKTXA.mjs.map +0 -1
  118. package/dist/chunk-FJLK5CFL.js.map +0 -1
  119. package/dist/chunk-GJSEBQXF.mjs +0 -392
  120. package/dist/chunk-GJSEBQXF.mjs.map +0 -1
  121. package/dist/chunk-J7ICRUU4.mjs +0 -426
  122. package/dist/chunk-J7ICRUU4.mjs.map +0 -1
  123. package/dist/chunk-KGDAENGD.js.map +0 -1
  124. package/dist/chunk-LD74LVRU.js +0 -47
  125. package/dist/chunk-LD74LVRU.js.map +0 -1
  126. package/dist/chunk-PCQVQ7SB.js +0 -45
  127. package/dist/chunk-PCQVQ7SB.js.map +0 -1
  128. package/dist/chunk-PR3JDWC3.mjs.map +0 -1
  129. package/dist/chunk-PWZBLTHR.js +0 -118
  130. package/dist/chunk-PWZBLTHR.js.map +0 -1
  131. package/dist/chunk-QEWDG5QE.mjs +0 -45
  132. package/dist/chunk-QEWDG5QE.mjs.map +0 -1
  133. package/dist/chunk-SMXXAVMB.js.map +0 -1
  134. package/dist/chunk-STV4ZVNA.mjs +0 -118
  135. package/dist/chunk-STV4ZVNA.mjs.map +0 -1
  136. package/dist/chunk-T5AZMMVS.mjs +0 -94
  137. package/dist/chunk-T5AZMMVS.mjs.map +0 -1
  138. package/dist/chunk-UU33HCCZ.mjs +0 -159
  139. package/dist/chunk-UU33HCCZ.mjs.map +0 -1
  140. package/dist/chunk-VGHLQXKB.js +0 -392
  141. package/dist/chunk-VGHLQXKB.js.map +0 -1
  142. package/dist/chunk-W5ZEP3CI.mjs.map +0 -1
  143. package/dist/chunk-Y666BJA5.mjs +0 -4
  144. package/dist/chunk-YFUZF7JM.mjs +0 -39
  145. package/dist/chunk-YFUZF7JM.mjs.map +0 -1
  146. package/dist/chunk-YN4436PK.mjs.map +0 -1
  147. package/dist/client-B2HqIKg6.d.ts +0 -51
  148. package/dist/client-XyCqclCi.d.mts +0 -51
  149. package/dist/client-browser.d.mts +0 -8
  150. package/dist/client-browser.d.ts +0 -8
  151. package/dist/client-browser.js +0 -85
  152. package/dist/client-browser.js.map +0 -1
  153. package/dist/client-browser.mjs +0 -85
  154. package/dist/client-browser.mjs.map +0 -1
  155. package/dist/client-node.d.mts +0 -8
  156. package/dist/client-node.d.ts +0 -8
  157. package/dist/client-node.js +0 -92
  158. package/dist/client-node.js.map +0 -1
  159. package/dist/client-node.mjs +0 -92
  160. package/dist/client-node.mjs.map +0 -1
  161. package/dist/evaluation/index.d.mts +0 -897
  162. package/dist/evaluation/index.d.ts +0 -897
  163. package/dist/evaluation/index.js +0 -14
  164. package/dist/evaluation/index.js.map +0 -1
  165. package/dist/evaluation/index.mjs +0 -14
  166. package/dist/filterable-batch-span-processor-zO5kcjBY.d.mts +0 -64
  167. package/dist/filterable-batch-span-processor-zO5kcjBY.d.ts +0 -64
  168. package/dist/init-XU2JFY6N.js +0 -16
  169. package/dist/list-7NPSX2E4.mjs.map +0 -1
  170. package/dist/list-ZXFLAF52.js.map +0 -1
  171. package/dist/login-76NQIHKR.js.map +0 -1
  172. package/dist/login-EK4WVOI2.mjs.map +0 -1
  173. package/dist/observability/index.d.mts +0 -260
  174. package/dist/observability/index.d.ts +0 -260
  175. package/dist/observability/index.js +0 -21
  176. package/dist/observability/index.js.map +0 -1
  177. package/dist/observability/index.mjs +0 -21
  178. package/dist/observability/index.mjs.map +0 -1
  179. package/dist/observability/instrumentation/langchain/index.d.mts +0 -40
  180. package/dist/observability/instrumentation/langchain/index.d.ts +0 -40
  181. package/dist/observability/instrumentation/langchain/index.js +0 -668
  182. package/dist/observability/instrumentation/langchain/index.js.map +0 -1
  183. package/dist/observability/instrumentation/langchain/index.mjs +0 -668
  184. package/dist/observability/instrumentation/langchain/index.mjs.map +0 -1
  185. package/dist/prompt/index.d.mts +0 -10
  186. package/dist/prompt/index.d.ts +0 -10
  187. package/dist/prompt/index.js +0 -22
  188. package/dist/prompt/index.js.map +0 -1
  189. package/dist/prompt/index.mjs +0 -22
  190. package/dist/prompt/index.mjs.map +0 -1
  191. package/dist/record-evaluation-CmxMXa-3.d.mts +0 -25
  192. package/dist/record-evaluation-CmxMXa-3.d.ts +0 -25
  193. package/dist/remove-SDJYEPAY.mjs.map +0 -1
  194. package/dist/remove-XBNGIVMR.js.map +0 -1
  195. package/dist/sync-EISKGPTL.js.map +0 -1
  196. package/dist/sync-ST2IWXSB.mjs.map +0 -1
  197. package/dist/trace-CqaKo0kZ.d.ts +0 -622
  198. package/dist/trace-DtVc5GhF.d.mts +0 -622
  199. /package/dist/{chunk-Y666BJA5.mjs.map → chunk-CU3443HD.mjs.map} +0 -0
  200. /package/dist/{chunk-E7UE2MPD.mjs.map → chunk-ECUXLXFT.mjs.map} +0 -0
  201. /package/dist/{create-QUZYBMQB.mjs.map → create-MK7NEGCM.mjs.map} +0 -0
  202. /package/dist/{init-H67RW22E.mjs.map → init-RINSTP4L.mjs.map} +0 -0
  203. /package/dist/{evaluation → observability-sdk}/index.mjs.map +0 -0
@@ -0,0 +1,368 @@
1
+ import { L as Logger } from '../../../index-DTEZr0Jn.mjs';
2
+ import { Instrumentation } from '@opentelemetry/instrumentation';
3
+ import { SpanExporter, SpanProcessor, SpanLimits, Sampler, IdGenerator } from '@opentelemetry/sdk-trace-base';
4
+ import { ContextManager, TextMapPropagator } from '@opentelemetry/api';
5
+ import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
6
+ import { IMetricReader, ViewOptions } from '@opentelemetry/sdk-metrics';
7
+ import { ResourceDetector, Resource } from '@opentelemetry/resources';
8
+ import { S as SemConvAttributes } from '../../../types-DRiQaKFG.mjs';
9
+ import { D as DataCaptureOptions } from '../../../types-Dmazk5Bk.mjs';
10
+ import '@opentelemetry/api-logs';
11
+ import '@opentelemetry/semantic-conventions';
12
+ import '@opentelemetry/semantic-conventions/incubating';
13
+
14
+ /**
15
+ * Configuration options for setting up LangWatch observability.
16
+ *
17
+ * This interface provides comprehensive configuration for initializing
18
+ * LangWatch tracing with a familiar flat structure for main options
19
+ * and grouped sections for debug and advanced configuration.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const options: SetupObservabilityOptions = {
24
+ * langwatch: {
25
+ * apiKey: "sk-lw-1234567890abcdef"
26
+ * },
27
+ * serviceName: "my-service",
28
+ * attributes: {
29
+ * "service.version": "1.0.0",
30
+ * "deployment.environment": "production"
31
+ * },
32
+ * spanProcessors: [new BatchSpanProcessor(new JaegerExporter())],
33
+ * debug: {
34
+ * consoleTracing: true,
35
+ * logLevel: 'debug'
36
+ * }
37
+ * };
38
+ * ```
39
+ */
40
+ interface SetupObservabilityOptions {
41
+ /**
42
+ * LangWatch configuration for sending observability data to LangWatch.
43
+ *
44
+ * Set to 'disabled' to completely disable LangWatch integration.
45
+ * API key and endpoint can also be set via LANGWATCH_API_KEY and
46
+ * LANGWATCH_ENDPOINT environment variables.
47
+ */
48
+ langwatch?: {
49
+ /**
50
+ * LangWatch API key for authentication.
51
+ * Defaults to LANGWATCH_API_KEY environment variable.
52
+ *
53
+ * @example "sk-lw-1234567890abcdef"
54
+ * @default LANGWATCH_API_KEY environment variable
55
+ */
56
+ apiKey?: string;
57
+ /**
58
+ * LangWatch endpoint URL for sending traces and logs.
59
+ * Defaults to LANGWATCH_ENDPOINT environment variable or production endpoint.
60
+ *
61
+ * @default "https://api.langwatch.ai"
62
+ * @default LANGWATCH_ENDPOINT environment variable
63
+ */
64
+ endpoint?: string;
65
+ /**
66
+ * Type of span processor to use for LangWatch exporter.
67
+ *
68
+ * - 'simple': Exports spans immediately (good for debugging)
69
+ * - 'batch': Batches spans for better performance (recommended for production)
70
+ *
71
+ * @default 'simple'
72
+ */
73
+ processorType?: "simple" | "batch";
74
+ } | "disabled";
75
+ /**
76
+ * Name of the service being instrumented.
77
+ * Used to identify your service in traces, logs, and metrics.
78
+ *
79
+ * @example "user-service"
80
+ */
81
+ serviceName?: string;
82
+ /**
83
+ * Global attributes added to all telemetry data.
84
+ * Useful for adding service-level metadata like version, environment, etc.
85
+ *
86
+ * @example { "service.version": "1.0.0", "deployment.environment": "production" }
87
+ */
88
+ attributes?: SemConvAttributes;
89
+ /**
90
+ * Configuration for automatic data capture.
91
+ *
92
+ * This provides control over input/output data capture by LangWatch instrumentations.
93
+ * You can use a simple string mode, a configuration object, or a predicate function
94
+ * for dynamic control based on the operation context.
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * // Simple mode - capture everything
99
+ * dataCapture: "all"
100
+ *
101
+ * // Simple mode - capture only input data
102
+ * dataCapture: "input"
103
+ *
104
+ * // Simple mode - capture only output data
105
+ * dataCapture: "output"
106
+ *
107
+ * // Simple mode - capture nothing
108
+ * dataCapture: "none"
109
+ *
110
+ * // Configuration object
111
+ * dataCapture: {
112
+ * mode: "all"
113
+ * }
114
+ *
115
+ * // Dynamic predicate function
116
+ * dataCapture: (context) => {
117
+ * // Don't capture sensitive data in production
118
+ * if (context.environment === "production" &&
119
+ * context.operationName.includes("password")) {
120
+ * return "none";
121
+ * }
122
+ * // Capture everything else
123
+ * return "all";
124
+ * }
125
+ * ```
126
+ *
127
+ * @default "all"
128
+ */
129
+ dataCapture?: DataCaptureOptions;
130
+ /**
131
+ * Custom trace exporter for sending spans to external systems.
132
+ * If not provided, LangWatch will create its own exporter.
133
+ * This is a simpler alternative to spanProcessors for single exporter use cases.
134
+ *
135
+ * @example new OTLPTraceExporter({ url: "https://custom-collector.com/v1/traces" })
136
+ */
137
+ traceExporter?: SpanExporter;
138
+ /**
139
+ * Custom span processors for advanced trace processing.
140
+ * Use this when you need full control over batching, filtering, or
141
+ * custom processing logic.
142
+ *
143
+ * @example [new SimpleSpanProcessor(new LangWatchExporter())]
144
+ * @example [new BatchSpanProcessor(exporter, { maxExportBatchSize: 100 })]
145
+ */
146
+ spanProcessors?: SpanProcessor[];
147
+ /**
148
+ * Span limits configuration.
149
+ * Controls the maximum number of attributes, events, and links per span.
150
+ *
151
+ * @example { attributeCountLimit: 128, eventCountLimit: 128 }
152
+ */
153
+ spanLimits?: SpanLimits;
154
+ /**
155
+ * Sampling strategy for controlling which traces to collect.
156
+ *
157
+ * @example new TraceIdRatioBasedSampler(0.1) // Sample 10% of traces
158
+ */
159
+ sampler?: Sampler;
160
+ /**
161
+ * Custom ID generator for span and trace IDs.
162
+ *
163
+ * @example new RandomIdGenerator()
164
+ */
165
+ idGenerator?: IdGenerator;
166
+ /**
167
+ * Custom log record processors for advanced log processing.
168
+ * Use this when you need full control over batching, filtering, or
169
+ * custom processing logic.
170
+ *
171
+ * @example [new BatchLogRecordProcessor(exporter, { maxExportBatchSize: 100 })]
172
+ */
173
+ logRecordProcessors?: LogRecordProcessor[];
174
+ /**
175
+ * Custom metric reader for collecting and exporting metrics.
176
+ *
177
+ * @example new PeriodicExportingMetricReader({ exporter: new PrometheusExporter() })
178
+ */
179
+ metricReader?: IMetricReader;
180
+ /**
181
+ * Metric views for controlling aggregation and filtering.
182
+ * Views determine which metrics are collected and how they are processed.
183
+ *
184
+ * @example [{ instrumentName: 'http.server.duration', aggregation: Aggregation.Histogram() }]
185
+ */
186
+ views?: ViewOptions[];
187
+ /**
188
+ * Auto-instrumentation libraries to enable.
189
+ * These automatically capture telemetry from common libraries and frameworks.
190
+ *
191
+ * @example [new HttpInstrumentation(), new ExpressInstrumentation()]
192
+ */
193
+ instrumentations?: (Instrumentation | Instrumentation[])[];
194
+ /**
195
+ * Whether to automatically detect and configure resource attributes.
196
+ * When enabled, OpenTelemetry automatically detects host, process, and environment info.
197
+ *
198
+ * @default true
199
+ */
200
+ autoDetectResources?: boolean;
201
+ /**
202
+ * Custom context manager for managing trace context across async operations.
203
+ */
204
+ contextManager?: ContextManager;
205
+ /**
206
+ * Text map propagator for trace context propagation across service boundaries.
207
+ * Controls how trace context is serialized in HTTP headers and other carriers.
208
+ *
209
+ * @example new W3CTraceContextPropagator()
210
+ */
211
+ textMapPropagator?: TextMapPropagator;
212
+ /**
213
+ * Resource detectors for automatic resource attribute detection.
214
+ * These detect information about the runtime environment.
215
+ *
216
+ * @example [envDetector, processDetector, hostDetector]
217
+ */
218
+ resourceDetectors?: Array<ResourceDetector>;
219
+ /**
220
+ * Custom resource configuration representing the entity being monitored.
221
+ * Includes service, host, and deployment metadata.
222
+ *
223
+ * @example new Resource({ "service.name": "my-service", "service.version": "1.0.0" })
224
+ */
225
+ resource?: Resource;
226
+ /**
227
+ * Debug and development options.
228
+ * These control console output and SDK internal logging behavior.
229
+ */
230
+ debug?: {
231
+ /**
232
+ * Enable console output for traces (debugging).
233
+ * When true, spans will be logged to the console in addition
234
+ * to any other configured exporters.
235
+ *
236
+ * @default false
237
+ */
238
+ consoleTracing?: boolean;
239
+ /**
240
+ * Enable console output for logs (debugging).
241
+ * When true, log records will be logged to the console in addition
242
+ * to any other configured exporters.
243
+ *
244
+ * @default false
245
+ */
246
+ consoleLogging?: boolean;
247
+ /**
248
+ * Log level for LangWatch SDK internal logging.
249
+ * Controls verbosity of SDK diagnostic messages.
250
+ *
251
+ * @default 'warn'
252
+ */
253
+ logLevel?: "debug" | "info" | "warn" | "error";
254
+ /**
255
+ * Custom logger for LangWatch SDK internal logging.
256
+ * If not provided, a console logger will be used.
257
+ */
258
+ logger?: Logger;
259
+ };
260
+ /**
261
+ * Advanced and potentially unsafe configuration options.
262
+ * These options are for special use cases and should be used with caution.
263
+ */
264
+ advanced?: {
265
+ /**
266
+ * Whether to throw errors during setup or return no-op handles.
267
+ *
268
+ * When false (default), setup errors are logged but the function
269
+ * returns no-op handles to prevent breaking your application.
270
+ * When true, setup errors will be thrown.
271
+ *
272
+ * @default false
273
+ */
274
+ throwOnSetupError?: boolean;
275
+ /**
276
+ * Skip OpenTelemetry setup entirely and return no-op handles.
277
+ * Useful when you want to handle OpenTelemetry setup yourself.
278
+ *
279
+ * @default false
280
+ */
281
+ skipOpenTelemetrySetup?: boolean;
282
+ /**
283
+ * Force reinitialization of OpenTelemetry even if already set up.
284
+ *
285
+ * WARNING: This can cause conflicts and is primarily intended for testing.
286
+ * Use with extreme caution in production.
287
+ *
288
+ * @default false
289
+ */
290
+ UNSAFE_forceOpenTelemetryReinitialization?: boolean;
291
+ /**
292
+ * Disable all observability setup and return no-op handles.
293
+ *
294
+ * When true, no OpenTelemetry setup will occur and all operations
295
+ * will be no-ops. Useful for testing or when you want to completely
296
+ * disable observability without changing your code.
297
+ *
298
+ * @default false
299
+ */
300
+ disabled?: boolean;
301
+ /**
302
+ * Disable the automatic shutdown of the observability system when the application
303
+ * terminates.
304
+ *
305
+ * @default false
306
+ */
307
+ disableAutoShutdown?: boolean;
308
+ };
309
+ }
310
+ /**
311
+ * Handle returned from observability setup. If you disable the automatic shutdown,
312
+ * do you are running in an environment where you can't listen to SIGTERM to handle
313
+ * shutdowns, you can use the shutdown function to manually shut down the
314
+ * observability system, and ensure that no data is lost.
315
+ *
316
+ * @example
317
+ * ```typescript
318
+ * const { shutdown } = setupObservability(options);
319
+ *
320
+ * // Shutdown when the application is terminating
321
+ * process.on('SIGTERM', async () => {
322
+ * await shutdown();
323
+ * process.exit(0);
324
+ * });
325
+ * ```
326
+ */
327
+ interface ObservabilityHandle {
328
+ /**
329
+ * Gracefully shuts down the observability system.
330
+ *
331
+ * This method should be called when the application is terminating
332
+ * to ensure all pending traces are exported before shutdown.
333
+ *
334
+ * The shutdown process:
335
+ * 1. Flushes any pending traces to the exporter
336
+ * 2. Closes the trace exporter
337
+ * 3. Shuts down the tracer provider
338
+ * 4. Cleans up any registered instrumentations
339
+ *
340
+ * @returns Promise that resolves when shutdown is complete
341
+ *
342
+ * @example
343
+ * ```typescript
344
+ * // Graceful shutdown
345
+ * process.on('SIGTERM', async () => {
346
+ * console.log('Shutting down observability...');
347
+ * await shutdown();
348
+ * console.log('Observability shutdown complete');
349
+ * process.exit(0);
350
+ * });
351
+ *
352
+ * // Force shutdown with timeout
353
+ * process.on('SIGINT', async () => {
354
+ * console.log('Force shutdown...');
355
+ * await Promise.race([
356
+ * shutdown(),
357
+ * new Promise(resolve => setTimeout(resolve, 5000))
358
+ * ]);
359
+ * process.exit(1);
360
+ * });
361
+ * ```
362
+ */
363
+ shutdown: () => Promise<void>;
364
+ }
365
+
366
+ declare function setupObservability(options?: SetupObservabilityOptions): ObservabilityHandle;
367
+
368
+ export { type ObservabilityHandle, type SetupObservabilityOptions, setupObservability };