@reactionary/source 0.0.37 → 0.0.39

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 (93) hide show
  1. package/.env-template +10 -0
  2. package/.github/workflows/pull-request.yml +5 -3
  3. package/core/package.json +1 -2
  4. package/core/src/client/client.ts +4 -2
  5. package/core/src/index.ts +3 -9
  6. package/core/src/providers/analytics.provider.ts +6 -1
  7. package/core/src/providers/base.provider.ts +33 -3
  8. package/core/src/providers/cart.provider.ts +7 -1
  9. package/core/src/providers/category.provider.ts +91 -0
  10. package/core/src/providers/identity.provider.ts +5 -1
  11. package/core/src/providers/inventory.provider.ts +4 -0
  12. package/core/src/providers/price.provider.ts +54 -0
  13. package/core/src/providers/product.provider.ts +4 -0
  14. package/core/src/providers/search.provider.ts +6 -0
  15. package/core/src/schemas/capabilities.schema.ts +3 -2
  16. package/core/src/schemas/models/base.model.ts +42 -1
  17. package/core/src/schemas/models/cart.model.ts +27 -3
  18. package/core/src/schemas/models/category.model.ts +23 -0
  19. package/core/src/schemas/models/identifiers.model.ts +29 -1
  20. package/core/src/schemas/models/inventory.model.ts +6 -2
  21. package/core/src/schemas/models/price.model.ts +11 -3
  22. package/core/src/schemas/models/search.model.ts +4 -2
  23. package/core/src/schemas/queries/category.query.ts +32 -0
  24. package/core/src/schemas/queries/index.ts +9 -0
  25. package/core/src/schemas/queries/inventory.query.ts +18 -3
  26. package/core/src/schemas/session.schema.ts +13 -2
  27. package/examples/next/.swcrc +30 -0
  28. package/examples/next/eslint.config.mjs +21 -0
  29. package/examples/next/index.d.ts +6 -0
  30. package/examples/next/next-env.d.ts +5 -0
  31. package/examples/next/next.config.js +20 -0
  32. package/examples/next/project.json +9 -0
  33. package/examples/next/public/.gitkeep +0 -0
  34. package/examples/next/public/favicon.ico +0 -0
  35. package/examples/next/src/app/global.css +0 -0
  36. package/examples/next/src/app/layout.tsx +18 -0
  37. package/examples/next/src/app/page.module.scss +2 -0
  38. package/examples/next/src/app/page.tsx +51 -0
  39. package/examples/next/src/instrumentation.ts +9 -0
  40. package/examples/next/tsconfig.json +44 -0
  41. package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +0 -1
  42. package/examples/node/src/basic/basic-node-setup.spec.ts +0 -1
  43. package/otel/README.md +152 -172
  44. package/otel/package.json +0 -1
  45. package/otel/src/index.ts +15 -5
  46. package/otel/src/metrics.ts +3 -3
  47. package/otel/src/test/otel.spec.ts +8 -0
  48. package/otel/src/trace-decorator.ts +87 -108
  49. package/otel/src/tracer.ts +3 -3
  50. package/package.json +2 -1
  51. package/providers/commercetools/package.json +1 -0
  52. package/providers/commercetools/src/core/initialize.ts +7 -3
  53. package/providers/commercetools/src/providers/cart.provider.ts +84 -8
  54. package/providers/commercetools/src/providers/category.provider.ts +244 -0
  55. package/providers/commercetools/src/providers/index.ts +7 -0
  56. package/providers/commercetools/src/providers/inventory.provider.ts +31 -14
  57. package/providers/commercetools/src/providers/price.provider.ts +74 -18
  58. package/providers/commercetools/src/providers/product.provider.ts +19 -15
  59. package/providers/commercetools/src/providers/search.provider.ts +9 -7
  60. package/providers/commercetools/src/schema/capabilities.schema.ts +2 -1
  61. package/providers/commercetools/src/schema/configuration.schema.ts +1 -1
  62. package/providers/commercetools/src/test/cart.provider.spec.ts +119 -0
  63. package/providers/commercetools/src/test/category.provider.spec.ts +180 -0
  64. package/providers/commercetools/src/test/price.provider.spec.ts +80 -0
  65. package/providers/commercetools/src/test/product.provider.spec.ts +29 -14
  66. package/providers/commercetools/src/test/search.provider.spec.ts +51 -9
  67. package/providers/commercetools/src/test/test-utils.ts +35 -0
  68. package/providers/commercetools/tsconfig.lib.json +1 -1
  69. package/providers/fake/jest.config.ts +10 -0
  70. package/providers/fake/src/core/initialize.ts +15 -1
  71. package/providers/fake/src/index.ts +2 -9
  72. package/providers/fake/src/providers/cart.provider.ts +74 -15
  73. package/providers/fake/src/providers/category.provider.ts +152 -0
  74. package/providers/fake/src/providers/index.ts +8 -0
  75. package/providers/fake/src/providers/inventory.provider.ts +23 -9
  76. package/providers/fake/src/providers/price.provider.ts +46 -6
  77. package/providers/fake/src/providers/search.provider.ts +13 -4
  78. package/providers/fake/src/schema/capabilities.schema.ts +4 -2
  79. package/providers/fake/src/schema/configuration.schema.ts +5 -0
  80. package/providers/fake/src/test/cart.provider.spec.ts +126 -0
  81. package/providers/fake/src/test/category.provider.spec.ts +134 -0
  82. package/providers/fake/src/test/price.provider.spec.ts +80 -0
  83. package/providers/fake/src/test/test-utils.ts +42 -0
  84. package/providers/fake/tsconfig.json +4 -0
  85. package/providers/fake/tsconfig.lib.json +3 -1
  86. package/providers/fake/tsconfig.spec.json +16 -0
  87. package/trpc/package.json +1 -2
  88. package/trpc/src/client.ts +1 -3
  89. package/trpc/src/integration.spec.ts +16 -10
  90. package/trpc/src/transparent-client.spec.ts +23 -17
  91. package/tsconfig.base.json +2 -0
  92. package/core/src/decorators/trpc.decorators.ts +0 -144
  93. package/otel/src/sdk.ts +0 -57
package/otel/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # @reactionary/otel
2
2
 
3
- Zero-configuration OpenTelemetry instrumentation for Reactionary framework. Automatically instruments tRPC routes and providers using standard OTEL environment variables.
3
+ OpenTelemetry instrumentation for the Reactionary framework. Provides decorators and utilities for tracing function execution and performance monitoring.
4
+
5
+ ## Important: SDK Initialization Required
6
+
7
+ This library provides **instrumentation only**. The host application is responsible for initializing the OpenTelemetry SDK. Without proper SDK initialization, traces will be created as `NonRecordingSpan` instances with zero trace/span IDs.
4
8
 
5
9
  ## Features
6
10
 
7
- - **Zero Configuration**: Auto-initializes on first use with standard OTEL env vars
8
- - **Automatic tRPC Route Tracing**: All tRPC procedures automatically traced
9
- - **Provider Instrumentation**: BaseProvider operations automatically instrumented
10
- - **Standard Compliance**: Uses official OpenTelemetry environment variables
11
- - **Multiple Exporters**: Console, OTLP/HTTP, or custom exporters
12
- - **Metrics Collection**: Request counts, durations, errors automatically tracked
13
- - **Lazy Initialization**: Only starts when actually used
11
+ - **Tracing Decorators**: Automatic span creation for decorated methods
12
+ - **Manual Instrumentation**: Utilities for custom tracing
13
+ - **Framework Integration**: Built-in support for tRPC and providers
14
+ - **Zero Dependencies**: Only requires OpenTelemetry API
15
+ - **Graceful Degradation**: Works without SDK initialization (produces no-op spans)
14
16
 
15
17
  ## Installation
16
18
 
@@ -18,230 +20,208 @@ Zero-configuration OpenTelemetry instrumentation for Reactionary framework. Auto
18
20
  pnpm add @reactionary/otel
19
21
  ```
20
22
 
21
- That's it! No initialization code needed.
23
+ **Important**: You must also install and configure the OpenTelemetry SDK in your host application.
22
24
 
23
- ## How It Works
25
+ ## Usage
24
26
 
25
- The OTEL package automatically initializes itself on first use, reading configuration from standard OpenTelemetry environment variables. When your code first creates a span or metric, the SDK initializes with your environment configuration.
27
+ ### Basic Tracing with Decorators
26
28
 
27
29
  ```typescript
28
- // No imports or initialization needed!
29
- // Just use your tRPC router or providers normally
30
- import { createTRPCRouter } from '@reactionary/trpc';
31
-
32
- const router = createTRPCRouter(client);
33
- // ↑ Automatically instrumented when OTEL env vars are set
34
- ```
35
-
36
- ## Configuration
37
-
38
- Use standard OpenTelemetry environment variables. No code changes needed.
39
-
40
- ### Standard Environment Variables
41
-
42
- ```bash
43
- # Service identification
44
- OTEL_SERVICE_NAME=my-service
45
- OTEL_SERVICE_VERSION=1.0.0
46
-
47
- # Traces exporter (console | otlp | otlp/http | none)
48
- OTEL_TRACES_EXPORTER=otlp
49
-
50
- # Metrics exporter (console | otlp | otlp/http | none)
51
- OTEL_METRICS_EXPORTER=otlp
52
-
53
- # OTLP endpoint and headers
54
- OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
55
- OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=your-api-key
56
-
57
- # Or use specific endpoints
58
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.honeycomb.io/v1/traces
59
- OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://api.honeycomb.io/v1/metrics
60
-
61
- # Debug logging
62
- OTEL_LOG_LEVEL=debug
63
-
64
- # Metrics export interval (milliseconds)
65
- OTEL_METRIC_EXPORT_INTERVAL=60000
66
- ```
30
+ import { traced } from '@reactionary/otel';
67
31
 
68
- See the [OpenTelemetry specification](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/) for all available options.
69
-
70
- ## Exporters
71
-
72
- ### Console (Development)
73
- ```bash
74
- OTEL_TRACES_EXPORTER=console
75
- OTEL_METRICS_EXPORTER=console
76
- ```
77
-
78
- ### OTLP (Production)
79
- Works with any OTLP-compatible backend:
80
-
81
- ```bash
82
- OTEL_TRACES_EXPORTER=otlp
83
- OTEL_METRICS_EXPORTER=otlp
84
- OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
85
- OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=your-api-key
86
- ```
32
+ class MyService {
33
+ @traced()
34
+ async fetchData(id: string): Promise<Data> {
35
+ // This method will be automatically traced
36
+ return await dataSource.get(id);
37
+ }
87
38
 
88
- ### Disable
89
- ```bash
90
- OTEL_TRACES_EXPORTER=none
91
- OTEL_METRICS_EXPORTER=none
39
+ @traced({
40
+ spanName: 'custom-operation',
41
+ captureResult: false
42
+ })
43
+ processData(data: Data): void {
44
+ // Custom span name and no result capture
45
+ }
46
+ }
92
47
  ```
93
48
 
94
- ## Custom Instrumentation
95
-
96
- ### Manual Spans
97
-
98
- Create custom spans for specific operations:
49
+ ### Manual Instrumentation
99
50
 
100
51
  ```typescript
101
52
  import { withSpan, getTracer } from '@reactionary/otel';
102
53
 
103
54
  // Using withSpan helper
104
- const result = await withSpan('custom-operation', async (span) => {
105
- span.setAttribute('custom.attribute', 'value');
106
- // Your operation here
107
- return someAsyncOperation();
55
+ const result = await withSpan('my-operation', async (span) => {
56
+ span.setAttribute('operation.id', operationId);
57
+ return await performOperation();
108
58
  });
109
59
 
110
60
  // Using tracer directly
111
61
  const tracer = getTracer();
112
62
  const span = tracer.startSpan('manual-span');
113
63
  try {
114
- // Your operation
64
+ // Your code here
115
65
  span.setStatus({ code: SpanStatusCode.OK });
116
66
  } catch (error) {
117
- span.recordException(error);
118
67
  span.setStatus({ code: SpanStatusCode.ERROR });
119
- throw error;
68
+ span.recordException(error);
120
69
  } finally {
121
70
  span.end();
122
71
  }
123
72
  ```
124
73
 
125
- ### Provider Instrumentation
74
+ ## Setting Up OpenTelemetry SDK
126
75
 
127
- Providers are automatically instrumented when extending BaseProvider:
76
+ ### Next.js Applications
128
77
 
129
- ```typescript
130
- import { BaseProvider } from '@reactionary/core';
78
+ 1. Create an `instrumentation.ts` file in your project root:
131
79
 
132
- class MyProvider extends BaseProvider {
133
- // Automatically traced when OTEL is initialized
134
- protected async fetch(queries, session) {
135
- // Your implementation
136
- }
137
-
138
- protected async process(mutations, session) {
139
- // Your implementation
80
+ ```typescript
81
+ // instrumentation.ts
82
+ export async function register() {
83
+ if (process.env.NEXT_RUNTIME === 'nodejs') {
84
+ const { NodeSDK } = await import('@opentelemetry/sdk-node');
85
+ const { getNodeAutoInstrumentations } = await import('@opentelemetry/auto-instrumentations-node');
86
+
87
+ const sdk = new NodeSDK({
88
+ instrumentations: [getNodeAutoInstrumentations()],
89
+ });
90
+
91
+ sdk.start();
140
92
  }
141
93
  }
142
94
  ```
143
95
 
144
- ### Custom Metrics
96
+ 2. Enable instrumentation in `next.config.js`:
145
97
 
146
- Track custom business metrics:
98
+ ```javascript
99
+ /** @type {import('next').NextConfig} */
100
+ const nextConfig = {
101
+ experimental: {
102
+ instrumentationHook: true,
103
+ },
104
+ };
147
105
 
148
- ```typescript
149
- import { getMetrics } from '@reactionary/otel';
106
+ module.exports = nextConfig;
107
+ ```
150
108
 
151
- const metrics = getMetrics();
109
+ 3. Configure environment variables:
152
110
 
153
- // Increment counter
154
- metrics.requestCounter.add(1, {
155
- 'endpoint': '/api/users',
156
- 'method': 'GET'
157
- });
111
+ ```bash
112
+ # .env.local
113
+ OTEL_SERVICE_NAME=my-nextjs-app
114
+ OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
115
+ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
116
+ ```
117
+
118
+ ### Node.js Applications
158
119
 
159
- // Record histogram
160
- metrics.requestDuration.record(150, {
161
- 'endpoint': '/api/users',
162
- 'status': 'success'
120
+ ```typescript
121
+ // Initialize at the very beginning of your application
122
+ import { NodeSDK } from '@opentelemetry/sdk-node';
123
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
124
+
125
+ const sdk = new NodeSDK({
126
+ instrumentations: [getNodeAutoInstrumentations()],
163
127
  });
128
+
129
+ sdk.start();
130
+
131
+ // Now import and use your application code
132
+ import './app';
164
133
  ```
165
134
 
166
- ## Examples
135
+ ### Environment Variables
167
136
 
168
- ### Honeycomb
137
+ The OpenTelemetry SDK can be configured using environment variables:
169
138
 
170
139
  ```bash
171
- OTEL_SERVICE_NAME=my-service
172
- OTEL_TRACES_EXPORTER=otlp
173
- OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
174
- OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=your-api-key
175
- ```
140
+ # Service identification
141
+ OTEL_SERVICE_NAME=my-app
142
+ OTEL_SERVICE_VERSION=1.0.0
176
143
 
177
- ### Local Development
144
+ # OTLP Exporter (for Jaeger, etc.)
145
+ OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
146
+ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
178
147
 
179
- ```bash
180
- OTEL_SERVICE_NAME=my-service-dev
148
+ # Console exporter (for development)
181
149
  OTEL_TRACES_EXPORTER=console
182
- OTEL_METRICS_EXPORTER=none # Disable metrics in dev
150
+
151
+ # Sampling (optional)
152
+ OTEL_TRACES_SAMPLER=always_on
153
+
154
+ # Debug logging
155
+ OTEL_LOG_LEVEL=debug
183
156
  ```
184
157
 
185
- ### Docker Compose with Jaeger
186
-
187
- ```yaml
188
- services:
189
- app:
190
- environment:
191
- - OTEL_EXPORTER_TYPE=otlp
192
- - OTEL_COLLECTOR_ENDPOINT=http://jaeger:4318
193
- - OTEL_SERVICE_NAME=my-service
194
-
195
- jaeger:
196
- image: jaegertracing/all-in-one:latest
197
- ports:
198
- - "16686:16686" # Jaeger UI
199
- - "4318:4318" # OTLP HTTP
158
+ ## Troubleshooting
159
+
160
+ ### ProxyTracer with NonRecordingSpan
161
+
162
+ If you see logs like:
163
+ ```
164
+ tracer: ProxyTracer { _provider: ProxyTracerProvider {} }
165
+ ending span: NonRecordingSpan { _spanContext: { traceId: '00000000000000000000000000000000' } }
200
166
  ```
201
167
 
202
- ## Metrics Reference
168
+ This means the OpenTelemetry SDK has not been initialized. Ensure you have:
169
+ 1. Created an `instrumentation.ts` file (Next.js)
170
+ 2. Initialized the SDK at application startup (Node.js)
171
+ 3. Set the required environment variables
203
172
 
204
- The following metrics are automatically collected:
173
+ ### Missing Traces
205
174
 
206
- | Metric | Type | Description |
207
- |--------|------|-------------|
208
- | `reactionary.requests` | Counter | Total number of requests |
209
- | `reactionary.request.duration` | Histogram | Request duration in milliseconds |
210
- | `reactionary.requests.active` | UpDownCounter | Number of active requests |
211
- | `reactionary.errors` | Counter | Total number of errors |
212
- | `reactionary.provider.calls` | Counter | Total provider calls |
213
- | `reactionary.provider.duration` | Histogram | Provider call duration |
214
- | `reactionary.cache.hits` | Counter | Cache hit count |
215
- | `reactionary.cache.misses` | Counter | Cache miss count |
175
+ If the decorator is being applied but you don't see traces:
176
+ 1. Verify the OTEL exporter is configured correctly
177
+ 2. Check that your tracing backend is running
178
+ 3. Ensure sampling is enabled (`OTEL_TRACES_SAMPLER=always_on`)
216
179
 
217
- ## Best Practices
180
+ ## API Reference
218
181
 
219
- 1. **Use Standard Variables**: Stick to OpenTelemetry standard environment variables
220
- 2. **Set Service Name**: Always set `OTEL_SERVICE_NAME` for service identification
221
- 3. **Environment-based Config**: Use different configs for dev/staging/production
222
- 4. **Add Context**: Use span attributes to add business context to traces
223
- 5. **Handle Errors**: Ensure spans are properly closed even on errors
224
- 6. **Sample Wisely**: Consider sampling strategies for high-volume services
225
- 7. **Monitor Performance**: Watch for overhead in high-throughput scenarios
182
+ ### Decorators
226
183
 
227
- ## Troubleshooting
184
+ #### `@traced(options?)`
228
185
 
229
- ### Traces Not Appearing
186
+ Decorates a method to automatically create spans for its execution.
230
187
 
231
- 1. Check OTEL is initialized before other components
232
- 2. Verify `OTEL_TRACE_ENABLED` is not set to `false`
233
- 3. Check exporter configuration and endpoint connectivity
234
- 4. Look for initialization errors in console
188
+ **Options:**
189
+ - `captureArgs?: boolean` - Capture function arguments (default: true)
190
+ - `captureResult?: boolean` - Capture return value (default: true)
191
+ - `spanName?: string` - Custom span name (default: ClassName.methodName)
192
+ - `spanKind?: SpanKind` - OpenTelemetry span kind (default: INTERNAL)
235
193
 
236
- ### Performance Impact
194
+ ### Utility Functions
195
+
196
+ - `getTracer(): Tracer` - Get the library's tracer instance
197
+ - `startSpan(name, options?, context?): Span` - Start a new span
198
+ - `withSpan<T>(name, fn, options?): Promise<T>` - Execute function within a span
199
+ - `setSpanAttributes(span, attributes): void` - Set multiple span attributes
200
+ - `createChildSpan(parent, name, options?): Span` - Create child span
201
+
202
+ ### Constants
203
+
204
+ - `SpanKind` - OpenTelemetry span kinds
205
+ - `SpanStatusCode` - OpenTelemetry span status codes
206
+
207
+ ## Examples
237
208
 
238
- - Use sampling to reduce overhead
239
- - Disable metrics if not needed
240
- - Consider using batch exporters
241
- - Increase export intervals for metrics
209
+ ### Console Output (Development)
210
+ ```bash
211
+ OTEL_SERVICE_NAME=my-service-dev
212
+ OTEL_TRACES_EXPORTER=console
213
+ ```
242
214
 
243
- ### Memory Usage
215
+ ### Jaeger (Local)
216
+ ```bash
217
+ OTEL_SERVICE_NAME=my-service
218
+ OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
219
+ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
220
+ ```
244
221
 
245
- - Monitor span processor queue size
246
- - Adjust batch size and timeout
247
- - Consider using sampling for high-volume services
222
+ ### Honeycomb (Production)
223
+ ```bash
224
+ OTEL_SERVICE_NAME=my-service
225
+ OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
226
+ OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=your-api-key
227
+ ```
package/otel/package.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
8
  "@opentelemetry/api": "^1.9.0",
9
- "@opentelemetry/sdk-node": "^0.203.0",
10
9
  "@trpc/server": "^11.1.2"
11
10
  }
12
11
  }
package/otel/src/index.ts CHANGED
@@ -1,12 +1,22 @@
1
- // OpenTelemetry auto-initialization based on standard environment variables
2
- // See: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
1
+ // OpenTelemetry instrumentation library
2
+ // This library provides instrumentation only - the host application
3
+ // is responsible for initializing the OpenTelemetry SDK
3
4
 
4
5
  // Framework integration exports (internal use only)
5
6
  export { createTRPCTracing } from './trpc-middleware';
6
7
  export { createProviderInstrumentation } from './provider-instrumentation';
7
8
 
8
9
  // Decorator for tracing functions
9
- export { traced, TracedOptions } from './trace-decorator';
10
+ export { traced } from './trace-decorator';
11
+ export type { TracedOptions } from './trace-decorator';
10
12
 
11
- // Graceful shutdown for process termination
12
- export { shutdownOtel } from './sdk';
13
+ // Utility functions for manual instrumentation
14
+ export {
15
+ getTracer,
16
+ startSpan,
17
+ withSpan,
18
+ setSpanAttributes,
19
+ createChildSpan,
20
+ SpanKind,
21
+ SpanStatusCode
22
+ } from './tracer';
@@ -1,5 +1,4 @@
1
1
  import { metrics, Meter, Counter, Histogram, UpDownCounter } from '@opentelemetry/api';
2
- import { isOtelInitialized } from './sdk';
3
2
 
4
3
  const METER_NAME = '@reactionary/otel';
5
4
  const METER_VERSION = '0.0.1';
@@ -8,8 +7,9 @@ let globalMeter: Meter | null = null;
8
7
 
9
8
  export function getMeter(): Meter {
10
9
  if (!globalMeter) {
11
- // Ensure OTEL is initialized before creating meter
12
- isOtelInitialized();
10
+ // Simply get the meter from the API
11
+ // If the SDK is not initialized by the host application,
12
+ // this will return a NoopMeter
13
13
  globalMeter = metrics.getMeter(METER_NAME, METER_VERSION);
14
14
  }
15
15
  return globalMeter;
@@ -0,0 +1,8 @@
1
+ import { getTracer } from '../tracer';
2
+ describe('Otel Integration', () => {
3
+ it('should initialize OpenTelemetry without errors', async () => {
4
+ const tracer = getTracer();
5
+
6
+ expect(tracer).toBeDefined();
7
+ });
8
+ });