@manifest-cyber/observability-ts 0.2.0 → 0.2.2
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/package.json +2 -5
- package/MIGRATION_GUIDE.md +0 -299
- package/TRACING_GUIDE.md +0 -791
- package/TRACING_IMPLEMENTATION_PLAN.md +0 -758
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifest-cyber/observability-ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Unified observability library for Manifest Cyber services - Metrics (Prometheus) and Tracing (OpenTelemetry)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"repository": "https://github.com/manifest-cyber/observability-ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"README.md"
|
|
11
|
-
"TRACING_GUIDE.md",
|
|
12
|
-
"TRACING_IMPLEMENTATION_PLAN.md",
|
|
13
|
-
"MIGRATION_GUIDE.md"
|
|
10
|
+
"README.md"
|
|
14
11
|
],
|
|
15
12
|
"exports": {
|
|
16
13
|
".": {
|
package/MIGRATION_GUIDE.md
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
# Migration Guide: @manifest-cyber/metrics → @manifest-cyber/observability-ts
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `@manifest-cyber/metrics` package has been renamed and expanded to `@manifest-cyber/observability-ts`, now including both **Prometheus metrics** and **OpenTelemetry distributed tracing**.
|
|
6
|
-
|
|
7
|
-
**All existing metrics code is fully backward compatible.** No breaking changes to your metrics implementation.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Quick Migration
|
|
12
|
-
|
|
13
|
-
### 1. Update Dependencies
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Remove old package
|
|
17
|
-
npm uninstall @manifest-cyber/metrics
|
|
18
|
-
|
|
19
|
-
# Install new package
|
|
20
|
-
npm install @manifest-cyber/observability-ts
|
|
21
|
-
|
|
22
|
-
# Install tracing peer dependencies (optional, only if using tracing)
|
|
23
|
-
npm install @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-grpc
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### 2. Update Imports
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
// Before
|
|
30
|
-
import { createCounter, startMetricsServer } from '@manifest-cyber/metrics';
|
|
31
|
-
|
|
32
|
-
// After - Option 1: Same imports work!
|
|
33
|
-
import { createCounter, startMetricsServer } from '@manifest-cyber/observability-ts';
|
|
34
|
-
|
|
35
|
-
// After - Option 2: Tree-shakeable (recommended)
|
|
36
|
-
import {
|
|
37
|
-
createCounter,
|
|
38
|
-
startMetricsServer,
|
|
39
|
-
} from '@manifest-cyber/observability-ts/metrics';
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 3. No Code Changes Required
|
|
43
|
-
|
|
44
|
-
All your existing metrics code continues to work exactly as before:
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
const requestsTotal = createCounter({
|
|
48
|
-
name: 'http_requests',
|
|
49
|
-
help: 'Total HTTP requests',
|
|
50
|
-
labelNames: ['method', 'status'],
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
startMetricsServer({ serviceName: 'my-service' });
|
|
54
|
-
|
|
55
|
-
requestsTotal.inc({ method: 'GET', status: '200' });
|
|
56
|
-
// ✅ Works exactly the same!
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## What's Changed
|
|
62
|
-
|
|
63
|
-
### Package Name
|
|
64
|
-
|
|
65
|
-
- **Old**: `@manifest-cyber/metrics`
|
|
66
|
-
- **New**: `@manifest-cyber/observability-ts`
|
|
67
|
-
|
|
68
|
-
### Repository Name
|
|
69
|
-
|
|
70
|
-
- **Old**: `https://github.com/manifest-cyber/metrics-ts`
|
|
71
|
-
- **New**: `https://github.com/manifest-cyber/observability-ts`
|
|
72
|
-
|
|
73
|
-
### What's Added
|
|
74
|
-
|
|
75
|
-
- ✨ OpenTelemetry distributed tracing
|
|
76
|
-
- ✨ W3C Trace Context propagation
|
|
77
|
-
- ✨ OTLP export to VictoriaTraces
|
|
78
|
-
- ✨ Integration with logger-ts for trace correlation
|
|
79
|
-
- ✨ Message queue trace propagation helpers
|
|
80
|
-
|
|
81
|
-
### What Hasn't Changed
|
|
82
|
-
|
|
83
|
-
- ✅ All metrics APIs (createCounter, createHistogram, createGauge)
|
|
84
|
-
- ✅ All instrumentation helpers (Timer, MetricsContext, trackOperation)
|
|
85
|
-
- ✅ Metrics server setup
|
|
86
|
-
- ✅ Bucket configurations
|
|
87
|
-
- ✅ Environment variables
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Step-by-Step Migration
|
|
92
|
-
|
|
93
|
-
### Step 1: Update package.json
|
|
94
|
-
|
|
95
|
-
```diff
|
|
96
|
-
{
|
|
97
|
-
"dependencies": {
|
|
98
|
-
- "@manifest-cyber/metrics": "^0.1.0",
|
|
99
|
-
+ "@manifest-cyber/observability-ts": "^0.2.0"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Step 2: Run npm install
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
npm install
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Step 3: Update imports across your codebase
|
|
111
|
-
|
|
112
|
-
#### Find all imports:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
grep -r "@manifest-cyber/metrics" --include="*.ts" --include="*.js"
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### Replace with:
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
// Option 1: Main export (everything)
|
|
122
|
-
import { createCounter } from '@manifest-cyber/observability-ts';
|
|
123
|
-
|
|
124
|
-
// Option 2: Metrics-only (tree-shakeable)
|
|
125
|
-
import { createCounter } from '@manifest-cyber/observability-ts/metrics';
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Step 4: Test
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
npm test
|
|
132
|
-
npm run build
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Your application should work exactly as before!
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Optional: Add Tracing
|
|
140
|
-
|
|
141
|
-
Once migrated, you can optionally add distributed tracing:
|
|
142
|
-
|
|
143
|
-
### 1. Install peer dependencies
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
npm install @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-grpc
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### 2. Initialize tracing
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
import { initTracing } from '@manifest-cyber/observability-ts';
|
|
153
|
-
|
|
154
|
-
// Add at application startup
|
|
155
|
-
await initTracing({
|
|
156
|
-
serviceName: process.env.SERVICE_NAME,
|
|
157
|
-
exporter: {
|
|
158
|
-
endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317',
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### 3. Add spans to your code
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
import { withSpan } from '@manifest-cyber/observability-ts';
|
|
167
|
-
|
|
168
|
-
await withSpan('operation.name', async () => {
|
|
169
|
-
// Your existing code
|
|
170
|
-
return await doWork();
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
See [TRACING_GUIDE.md](./TRACING_GUIDE.md) for complete tracing documentation.
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## NPM Package Status
|
|
179
|
-
|
|
180
|
-
### Old Package: @manifest-cyber/metrics
|
|
181
|
-
|
|
182
|
-
The old package is **deprecated** on NPM:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
npm deprecate @manifest-cyber/metrics "*" "Package renamed to @manifest-cyber/observability-ts"
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
When users try to install the old package, they'll see:
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
npm WARN deprecated @manifest-cyber/metrics@0.1.0: Package renamed to @manifest-cyber/observability-ts
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### New Package: @manifest-cyber/observability-ts
|
|
195
|
-
|
|
196
|
-
Published and ready to use:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
npm install @manifest-cyber/observability-ts
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Environment Variables
|
|
205
|
-
|
|
206
|
-
No changes to existing environment variables:
|
|
207
|
-
|
|
208
|
-
| Variable | Purpose | Default |
|
|
209
|
-
| ------------------- | ----------------------------------- | ------------------- |
|
|
210
|
-
| `SERVICE_NAME` | Service name for metrics and traces | `'unknown-service'` |
|
|
211
|
-
| `MFST_METRICS_PORT` | Metrics server port | `9090` |
|
|
212
|
-
|
|
213
|
-
**New variables for tracing** (optional):
|
|
214
|
-
| Variable | Purpose | Default |
|
|
215
|
-
|----------|---------|---------|
|
|
216
|
-
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP exporter endpoint | `'http://localhost:4317'` |
|
|
217
|
-
| `OTEL_TRACING_ENABLED` | Enable/disable tracing | `true` |
|
|
218
|
-
| `ENV` | Environment (dev/staging/prod) | `'development'` |
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Breaking Changes
|
|
223
|
-
|
|
224
|
-
**None!** This is a backward-compatible migration.
|
|
225
|
-
|
|
226
|
-
The only "breaking" change is the package name itself, but all APIs remain unchanged.
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## Rollback Plan
|
|
231
|
-
|
|
232
|
-
If you encounter issues, you can roll back:
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
npm uninstall @manifest-cyber/observability-ts
|
|
236
|
-
npm install @manifest-cyber/metrics@0.1.0
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
Then revert your import changes.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Update Checklist
|
|
244
|
-
|
|
245
|
-
- [ ] Update `package.json` with new package name
|
|
246
|
-
- [ ] Run `npm install`
|
|
247
|
-
- [ ] Update all imports from `@manifest-cyber/metrics` to `@manifest-cyber/observability-ts`
|
|
248
|
-
- [ ] Run tests to verify functionality
|
|
249
|
-
- [ ] Build and deploy to development environment
|
|
250
|
-
- [ ] Verify metrics still appear in Grafana
|
|
251
|
-
- [ ] (Optional) Add tracing configuration
|
|
252
|
-
- [ ] (Optional) Update CI/CD pipelines with new package name
|
|
253
|
-
- [ ] Update team documentation
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## Services to Update
|
|
258
|
-
|
|
259
|
-
All services currently using `@manifest-cyber/metrics`:
|
|
260
|
-
|
|
261
|
-
```bash
|
|
262
|
-
# Find all services with the old package
|
|
263
|
-
cd /Users/codymoore/Workspace/manifest
|
|
264
|
-
grep -l "@manifest-cyber/metrics" */package.json
|
|
265
|
-
|
|
266
|
-
# Example services:
|
|
267
|
-
# - manifest-api
|
|
268
|
-
# - job-sbom-process
|
|
269
|
-
# - job-vulnerability-match
|
|
270
|
-
# - job-component-process
|
|
271
|
-
# - chronotrigger
|
|
272
|
-
# - (etc.)
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Timeline
|
|
278
|
-
|
|
279
|
-
| Phase | Duration | Description |
|
|
280
|
-
| ----------- | -------- | -------------------------------------------------------- |
|
|
281
|
-
| **Phase 1** | Week 1 | Publish `observability-ts` v0.2.0, deprecate old package |
|
|
282
|
-
| **Phase 2** | Week 2-3 | Migrate all services in development environment |
|
|
283
|
-
| **Phase 3** | Week 4 | Validate in staging |
|
|
284
|
-
| **Phase 4** | Week 5 | Production rollout |
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Support
|
|
289
|
-
|
|
290
|
-
For questions or issues:
|
|
291
|
-
|
|
292
|
-
- GitHub Issues: [observability-ts/issues](https://github.com/manifest-cyber/observability-ts/issues)
|
|
293
|
-
- Platform Team: Contact via Slack #platform-team
|
|
294
|
-
- Documentation: See [README.md](./README.md) and [TRACING_GUIDE.md](./TRACING_GUIDE.md)
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
**Document Owner**: Platform Team
|
|
299
|
-
**Last Updated**: November 11, 2025
|