@vzn/vx-otel 0.0.503 → 0.0.505

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 (3) hide show
  1. package/README.md +6 -1
  2. package/package.json +2 -2
  3. package/src/otlp.ts +15 -0
package/README.md CHANGED
@@ -99,6 +99,7 @@ otel({
99
99
  `cicd.pipeline.task.run.result` (the convention's enum: `success` for a
100
100
  run or a hit, `failure`, `timeout`, `skip`, `cancellation`), vx's own
101
101
  status as `vx.task.status`, `vx.cache.source` (miss/local/remote, or none for a task that never ran),
102
+ on a hit `vx.cache.restored` (`true` when it restored outputs, `false` when they were already up to date),
102
103
  `vx.task.hash`, duration, CPU ms, peak RSS, and on a skipped task its root
103
104
  blocker (`vx.task.blocked_by`), on a timed-out one `vx.task.timed_out`, on
104
105
  a sandboxed one its violation count (`vx.task.sandbox_violations`), on a
@@ -107,7 +108,11 @@ otel({
107
108
  `ERROR`.
108
109
 
109
110
  **Metrics per run**: `vx.tasks.total`, `vx.tasks.failed`,
110
- `vx.tasks.cache_hits{source=local|remote}`, and the `vx.run.duration_ms` gauge.
111
+ `vx.tasks.cache_hits{source=local|remote}`, what those hits did to the disk as
112
+ `vx.tasks.cache_restored{source=local|remote}` and `vx.tasks.cache_up_to_date`,
113
+ and the `vx.run.duration_ms` gauge. The `vx.run` span carries the same counts
114
+ (`vx.run.hit_count`, `vx.run.up_to_date_count`, `vx.run.restored_local_count`,
115
+ `vx.run.restored_remote_count`).
111
116
  The counts are DELTA sums over the run's own interval (start to end), so a
112
117
  backend adds runs rather than reading each as the series' new total.
113
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-otel",
3
- "version": "0.0.503",
3
+ "version": "0.0.505",
4
4
  "license": "MIT",
5
5
  "description": "OpenTelemetry exporter for vx — a telemetry plugin mapping runs to OTLP traces + metrics (CI/CD + VCS semantic conventions).",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "peerDependencies": {
37
- "@vzn/vx": "^0.0.503"
37
+ "@vzn/vx": "^0.0.505"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
package/src/otlp.ts CHANGED
@@ -101,12 +101,16 @@ const VX_ATTR = {
101
101
  runHitCount: 'vx.run.hit_count',
102
102
  runHitLocalCount: 'vx.run.hit_local_count',
103
103
  runHitRemoteCount: 'vx.run.hit_remote_count',
104
+ runUpToDateCount: 'vx.run.up_to_date_count',
105
+ runRestoredLocalCount: 'vx.run.restored_local_count',
106
+ runRestoredRemoteCount: 'vx.run.restored_remote_count',
104
107
  runExitOk: 'vx.run.exit_ok',
105
108
  // task
106
109
  taskProject: 'vx.task.project',
107
110
  taskRunStartedAt: 'vx.task.run_started_at',
108
111
  taskTask: 'vx.task.task',
109
112
  cacheSource: 'vx.cache.source',
113
+ cacheRestored: 'vx.cache.restored',
110
114
  taskExitCode: 'vx.task.exit_code',
111
115
  taskStatus: 'vx.task.status',
112
116
  taskDurationMs: 'vx.task.duration_ms',
@@ -217,6 +221,9 @@ export function runSpanAttributes(run: RunContextRecord, summary?: RunSummaryRec
217
221
  intAttr(VX_ATTR.runHitCount, summary.hitCount),
218
222
  intAttr(VX_ATTR.runHitLocalCount, summary.hitLocalCount),
219
223
  intAttr(VX_ATTR.runHitRemoteCount, summary.hitRemoteCount),
224
+ intAttr(VX_ATTR.runUpToDateCount, summary.upToDateCount),
225
+ intAttr(VX_ATTR.runRestoredLocalCount, summary.restoredLocalCount),
226
+ intAttr(VX_ATTR.runRestoredRemoteCount, summary.restoredRemoteCount),
220
227
  boolAttr(VX_ATTR.runExitOk, summary.exitOk),
221
228
  strAttr(SEMCONV.pipelineResult, pipelineResult(summary)),
222
229
  )
@@ -302,6 +309,7 @@ export function taskSpanAttributes(t: TaskTelemetry, run: TaskSpanRunContext): K
302
309
  intAttr(VX_ATTR.taskDurationMs, t.durationMs),
303
310
  ]
304
311
  if (t.hash !== undefined) attrs.push(strAttr(VX_ATTR.taskHash, t.hash))
312
+ if (t.restored !== undefined) attrs.push(boolAttr(VX_ATTR.cacheRestored, t.restored))
305
313
  if (t.cpuMs !== undefined) attrs.push(intAttr(VX_ATTR.cpuMs, t.cpuMs))
306
314
  if (t.where !== undefined) attrs.push(strAttr(VX_ATTR.taskWhere, t.where))
307
315
  // A skipped task's root blocker (a task id, as the record carries it).
@@ -392,6 +400,13 @@ export function buildMetricsRequest(
392
400
  point(summary.hitLocalCount, [strAttr('source', 'local')]),
393
401
  point(summary.hitRemoteCount, [strAttr('source', 'remote')]),
394
402
  ]),
403
+ // What the hits did to the disk: restored outputs (by the
404
+ // layer they came from) or found them already in place.
405
+ sum('vx.tasks.cache_restored', [
406
+ point(summary.restoredLocalCount, [strAttr('source', 'local')]),
407
+ point(summary.restoredRemoteCount, [strAttr('source', 'remote')]),
408
+ ]),
409
+ sum('vx.tasks.cache_up_to_date', [point(summary.upToDateCount)]),
395
410
  gauge('vx.run.duration_ms', summary.totalDurationMs),
396
411
  ],
397
412
  },