@breadstone/archipel-platform-telemetry 0.0.24 → 0.0.25

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 CHANGED
@@ -8,7 +8,7 @@ Application monitoring, metrics, and distributed tracing infrastructure for Nest
8
8
  - **Distributed tracing** — OpenTelemetry SDK integration with automatic span creation
9
9
  - **Operation interceptor** — `OperationTelemetryInterceptor` wraps controller methods in telemetry operations
10
10
  - **Graceful degradation** — Falls back to `NoopTelemetryFacade` when disabled — zero overhead
11
- - **Health checks** — Integration with health module for observability readiness
11
+ - **Health checks** — `TelemetryHealthIndicator` for readiness probes (separate `/health` subpath)
12
12
  - **Structured logging** — `TelemetryLoggerService` with request correlation IDs
13
13
  - **Eager metric init** — `MetricsService` creates instruments at startup via `OnModuleInit`
14
14
  - **Write-once SDK guard** — `OtelSdkHolder` prevents accidental double-initialization of the OpenTelemetry SDK
@@ -19,6 +19,9 @@ Application monitoring, metrics, and distributed tracing infrastructure for Nest
19
19
  ```typescript
20
20
  import { TelemetryModule } from '@breadstone/archipel-platform-telemetry';
21
21
 
22
+ // Health indicator (optional)
23
+ import { TelemetryHealthIndicator } from '@breadstone/archipel-platform-telemetry/health';
24
+
22
25
  @Module({
23
26
  imports: [TelemetryModule],
24
27
  })
@@ -32,15 +35,17 @@ export class AppModule {}
32
35
 
33
36
  ## Peer Dependencies
34
37
 
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 |
38
+ | Package | Required | Notes |
39
+ | ------------------------------------------- | -------- | ----------------------------- |
40
+ | `@nestjs/common` | Yes | NestJS core |
41
+ | `@nestjs/core` | Yes | NestJS core |
42
+ | `@opentelemetry/api` | Yes | OpenTelemetry API |
43
+ | `@opentelemetry/sdk-node` | Yes | OpenTelemetry SDK |
44
+ | `@opentelemetry/exporter-metrics-otlp-http` | Yes | Metrics exporter |
45
+ | `@opentelemetry/exporter-trace-otlp-http` | Yes | Trace exporter |
46
+ | `rxjs` | Yes | Reactive streams |
47
+ | `@breadstone/archipel-platform-health` | No | Required for health indicator |
48
+ | `@nestjs/terminus` | No | Required for health indicator |
44
49
 
45
50
  ## Documentation
46
51
 
package/package.json CHANGED
@@ -1,10 +1,27 @@
1
1
  {
2
2
  "name": "@breadstone/archipel-platform-telemetry",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
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",
7
7
  "types": "./src/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "health": [
11
+ "./src/health/index.d.ts"
12
+ ]
13
+ }
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "types": "./src/index.d.ts",
18
+ "default": "./src/index.js"
19
+ },
20
+ "./health": {
21
+ "types": "./src/health/index.d.ts",
22
+ "default": "./src/health/index.js"
23
+ }
24
+ },
8
25
  "license": "MIT",
9
26
  "repository": {
10
27
  "type": "git",
@@ -28,13 +45,15 @@
28
45
  "README.md"
29
46
  ],
30
47
  "dependencies": {
31
- "@breadstone/archipel-platform-caching": "0.0.24",
32
- "@breadstone/archipel-platform-core": "0.0.24",
48
+ "@breadstone/archipel-platform-caching": "0.0.25",
49
+ "@breadstone/archipel-platform-core": "0.0.25",
33
50
  "tslib": "2.8.1"
34
51
  },
35
52
  "peerDependencies": {
53
+ "@breadstone/archipel-platform-health": ">=0.0.1",
36
54
  "@nestjs/common": ">=11.0.0",
37
55
  "@nestjs/core": ">=11.0.0",
56
+ "@nestjs/terminus": ">=11.0.0",
38
57
  "@opentelemetry/api": ">=1.9.0",
39
58
  "@opentelemetry/exporter-metrics-otlp-http": ">=0.200.0",
40
59
  "@opentelemetry/exporter-trace-otlp-http": ">=0.200.0",
@@ -46,6 +65,12 @@
46
65
  "rxjs": ">=7.0.0"
47
66
  },
48
67
  "peerDependenciesMeta": {
68
+ "@breadstone/archipel-platform-health": {
69
+ "optional": true
70
+ },
71
+ "@nestjs/terminus": {
72
+ "optional": true
73
+ },
49
74
  "@opentelemetry/api": {
50
75
  "optional": true
51
76
  },
@@ -10,6 +10,12 @@ import { OnApplicationShutdown } from '@nestjs/common';
10
10
  export declare class OtelSdkHolder implements OnApplicationShutdown {
11
11
  private readonly _logger;
12
12
  private _sdk?;
13
+ /**
14
+ * Whether the OpenTelemetry SDK has been initialized.
15
+ *
16
+ * @public
17
+ */
18
+ get isInitialized(): boolean;
13
19
  /**
14
20
  * Stores the SDK reference so it can be shut down later.
15
21
  * Can only be called once - subsequent calls are ignored.
@@ -21,6 +21,16 @@ let OtelSdkHolder = OtelSdkHolder_1 = class OtelSdkHolder {
21
21
  // #endregion
22
22
  }
23
23
  // #endregion
24
+ // #region Properties
25
+ /**
26
+ * Whether the OpenTelemetry SDK has been initialized.
27
+ *
28
+ * @public
29
+ */
30
+ get isInitialized() {
31
+ return this._sdk !== undefined;
32
+ }
33
+ // #endregion
24
34
  // #region Methods
25
35
  /**
26
36
  * Stores the SDK reference so it can be shut down later.
@@ -0,0 +1,22 @@
1
+ import { IHealthIndicator } from '@breadstone/archipel-platform-health';
2
+ import { HealthIndicatorResult } from '@nestjs/terminus';
3
+ import { OtelSdkHolder } from '../OtelSdkHolder';
4
+ /**
5
+ * Health indicator for the telemetry infrastructure.
6
+ * Checks whether the OpenTelemetry SDK has been initialized via {@link OtelSdkHolder}.
7
+ *
8
+ * @public
9
+ */
10
+ export declare class TelemetryHealthIndicator implements IHealthIndicator {
11
+ private readonly _sdkHolder?;
12
+ constructor(sdkHolder?: OtelSdkHolder);
13
+ readonly key: string;
14
+ /**
15
+ * Checks whether the OpenTelemetry SDK has been initialized.
16
+ * Returns disabled status when no SDK holder is configured.
17
+ *
18
+ * @public
19
+ * @returns The health indicator result.
20
+ */
21
+ check(): HealthIndicatorResult<string>;
22
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TelemetryHealthIndicator = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const OtelSdkHolder_1 = require("../OtelSdkHolder");
8
+ // #endregion
9
+ /**
10
+ * Health indicator for the telemetry infrastructure.
11
+ * Checks whether the OpenTelemetry SDK has been initialized via {@link OtelSdkHolder}.
12
+ *
13
+ * @public
14
+ */
15
+ let TelemetryHealthIndicator = class TelemetryHealthIndicator {
16
+ // #endregion
17
+ // #region Ctor
18
+ constructor(sdkHolder) {
19
+ // #endregion
20
+ // #region Properties
21
+ this.key = 'telemetry';
22
+ this._sdkHolder = sdkHolder;
23
+ }
24
+ // #endregion
25
+ // #region Methods
26
+ /**
27
+ * Checks whether the OpenTelemetry SDK has been initialized.
28
+ * Returns disabled status when no SDK holder is configured.
29
+ *
30
+ * @public
31
+ * @returns The health indicator result.
32
+ */
33
+ check() {
34
+ if (!this._sdkHolder) {
35
+ return {
36
+ telemetry: {
37
+ status: 'up',
38
+ disabled: true,
39
+ },
40
+ };
41
+ }
42
+ return {
43
+ telemetry: {
44
+ status: this._sdkHolder.isInitialized ? 'up' : 'down',
45
+ sdkInitialized: this._sdkHolder.isInitialized,
46
+ },
47
+ };
48
+ }
49
+ };
50
+ exports.TelemetryHealthIndicator = TelemetryHealthIndicator;
51
+ exports.TelemetryHealthIndicator = TelemetryHealthIndicator = tslib_1.__decorate([
52
+ (0, common_1.Injectable)(),
53
+ tslib_1.__param(0, (0, common_1.Optional)()),
54
+ tslib_1.__metadata("design:paramtypes", [OtelSdkHolder_1.OtelSdkHolder])
55
+ ], TelemetryHealthIndicator);
56
+ //# sourceMappingURL=TelemetryHealthIndicator.js.map
@@ -0,0 +1 @@
1
+ export { TelemetryHealthIndicator } from './TelemetryHealthIndicator';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TelemetryHealthIndicator = void 0;
4
+ var TelemetryHealthIndicator_1 = require("./TelemetryHealthIndicator");
5
+ Object.defineProperty(exports, "TelemetryHealthIndicator", { enumerable: true, get: function () { return TelemetryHealthIndicator_1.TelemetryHealthIndicator; } });
6
+ //# sourceMappingURL=index.js.map