@breadstone/archipel-platform-telemetry 0.0.22 → 0.0.24
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/README.md +35 -13
- package/package.json +3 -3
- package/src/OtelSdkHolder.d.ts +1 -1
- package/src/OtelSdkHolder.js +2 -2
package/README.md
CHANGED
|
@@ -1,28 +1,50 @@
|
|
|
1
1
|
# @breadstone/archipel-platform-telemetry
|
|
2
2
|
|
|
3
|
-
Application monitoring, metrics, and
|
|
3
|
+
Application monitoring, metrics, and distributed tracing infrastructure for NestJS.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Metrics collection** — Counter, histogram, and gauge recording via `TelemetryFacade`
|
|
8
|
+
- **Distributed tracing** — OpenTelemetry SDK integration with automatic span creation
|
|
9
|
+
- **Operation interceptor** — `OperationTelemetryInterceptor` wraps controller methods in telemetry operations
|
|
10
|
+
- **Graceful degradation** — Falls back to `NoopTelemetryFacade` when disabled — zero overhead
|
|
11
|
+
- **Health checks** — Integration with health module for observability readiness
|
|
12
|
+
- **Structured logging** — `TelemetryLoggerService` with request correlation IDs
|
|
13
|
+
- **Eager metric init** — `MetricsService` creates instruments at startup via `OnModuleInit`
|
|
14
|
+
- **Write-once SDK guard** — `OtelSdkHolder` prevents accidental double-initialization of the OpenTelemetry SDK
|
|
15
|
+
- **Shutdown timeout** — SDK shutdown is capped at 5 seconds to prevent hanging processes
|
|
4
16
|
|
|
5
17
|
## Quick Start
|
|
6
18
|
|
|
7
19
|
```typescript
|
|
8
20
|
import { TelemetryModule } from '@breadstone/archipel-platform-telemetry';
|
|
21
|
+
|
|
22
|
+
@Module({
|
|
23
|
+
imports: [TelemetryModule],
|
|
24
|
+
})
|
|
25
|
+
export class AppModule {}
|
|
9
26
|
```
|
|
10
27
|
|
|
11
|
-
##
|
|
28
|
+
## Lifecycle
|
|
12
29
|
|
|
13
|
-
|
|
30
|
+
- **Startup (`OnModuleInit`):** `MetricsService` creates metric instruments eagerly.
|
|
31
|
+
- **Shutdown:** SDK shutdown is capped at 5 seconds to prevent hanging processes.
|
|
14
32
|
|
|
15
|
-
##
|
|
33
|
+
## Peer Dependencies
|
|
34
|
+
|
|
35
|
+
| Package | Required | Notes |
|
|
36
|
+
| ------------------------------------------- | -------- | ----------------- |
|
|
37
|
+
| `@nestjs/common` | Yes | NestJS core |
|
|
38
|
+
| `@nestjs/core` | Yes | NestJS core |
|
|
39
|
+
| `@opentelemetry/api` | Yes | OpenTelemetry API |
|
|
40
|
+
| `@opentelemetry/sdk-node` | Yes | OpenTelemetry SDK |
|
|
41
|
+
| `@opentelemetry/exporter-metrics-otlp-http` | Yes | Metrics exporter |
|
|
42
|
+
| `@opentelemetry/exporter-trace-otlp-http` | Yes | Trace exporter |
|
|
43
|
+
| `rxjs` | Yes | Reactive streams |
|
|
16
44
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- **Graceful degradation**: Falls back to `NoopTelemetryFacade` when disabled — zero overhead
|
|
21
|
-
- **Health checks**: Integration with health module for observability readiness
|
|
22
|
-
- **Structured logging**: `TelemetryLoggerService` with request correlation IDs
|
|
23
|
-
- **Eager metric init**: `MetricsService` creates instruments at startup via `OnModuleInit`
|
|
24
|
-
- **Write-once SDK guard**: `OtelSdkHolder` prevents accidental double-initialization of the OpenTelemetry SDK
|
|
25
|
-
- **Shutdown timeout**: SDK shutdown is capped at 5 seconds to prevent hanging processes
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
📖 **Telemetry Guide:** [`.docs/guides/telemetry-and-observability.md`](../../.docs/guides/telemetry-and-observability.md)
|
|
26
48
|
|
|
27
49
|
## Development
|
|
28
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone/archipel-platform-telemetry",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "OpenTelemetry integration with tracing, metrics, and graceful no-op fallback for NestJS.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@breadstone/archipel-platform-caching": "0.0.
|
|
32
|
-
"@breadstone/archipel-platform-core": "0.0.
|
|
31
|
+
"@breadstone/archipel-platform-caching": "0.0.24",
|
|
32
|
+
"@breadstone/archipel-platform-core": "0.0.24",
|
|
33
33
|
"tslib": "2.8.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
package/src/OtelSdkHolder.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class OtelSdkHolder implements OnApplicationShutdown {
|
|
|
12
12
|
private _sdk?;
|
|
13
13
|
/**
|
|
14
14
|
* Stores the SDK reference so it can be shut down later.
|
|
15
|
-
* Can only be called once
|
|
15
|
+
* Can only be called once - subsequent calls are ignored.
|
|
16
16
|
*/
|
|
17
17
|
setSdk(sdk: unknown): void;
|
|
18
18
|
/** @inheritdoc */
|
package/src/OtelSdkHolder.js
CHANGED
|
@@ -24,11 +24,11 @@ let OtelSdkHolder = OtelSdkHolder_1 = class OtelSdkHolder {
|
|
|
24
24
|
// #region Methods
|
|
25
25
|
/**
|
|
26
26
|
* Stores the SDK reference so it can be shut down later.
|
|
27
|
-
* Can only be called once
|
|
27
|
+
* Can only be called once - subsequent calls are ignored.
|
|
28
28
|
*/
|
|
29
29
|
setSdk(sdk) {
|
|
30
30
|
if (this._sdk) {
|
|
31
|
-
this._logger.warn('OtelSdkHolder.setSdk() called more than once
|
|
31
|
+
this._logger.warn('OtelSdkHolder.setSdk() called more than once - ignoring.');
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
this._sdk = sdk;
|