@uploadista/observability 0.0.20-beta.6 → 0.0.20-beta.8
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +77 -77
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/upload/errors.ts +2 -2
- package/src/upload/layers.ts +4 -4
- package/src/upload/metrics.ts +3 -3
- package/src/upload/testing.ts +3 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/observability",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.20-beta.
|
|
4
|
+
"version": "0.0.20-beta.8",
|
|
5
5
|
"description": "Observability package for Uploadista",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@effect/opentelemetry": "0.59.
|
|
17
|
+
"@effect/opentelemetry": "0.59.3",
|
|
18
18
|
"@opentelemetry/api": "1.9.0",
|
|
19
19
|
"@opentelemetry/api-logs": "0.208.0",
|
|
20
20
|
"@opentelemetry/exporter-metrics-otlp-http": "0.208.0",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"effect": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@cloudflare/workers-types": "4.
|
|
33
|
+
"@cloudflare/workers-types": "4.20251213.0",
|
|
34
34
|
"@effect/vitest": "0.27.0",
|
|
35
|
-
"@types/node": "24.10.
|
|
36
|
-
"effect": "3.19.
|
|
37
|
-
"tsdown": "0.
|
|
35
|
+
"@types/node": "24.10.4",
|
|
36
|
+
"effect": "3.19.12",
|
|
37
|
+
"tsdown": "0.18.0",
|
|
38
38
|
"typescript": "5.9.3",
|
|
39
39
|
"vitest": "4.0.15",
|
|
40
|
-
"@uploadista/typescript-config": "0.0.20-beta.
|
|
40
|
+
"@uploadista/typescript-config": "0.0.20-beta.8"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "tsdown",
|
|
43
|
+
"build": "tsc --noEmit && tsdown",
|
|
44
44
|
"format": "biome format --write ./src",
|
|
45
45
|
"lint": "biome lint --write ./src",
|
|
46
46
|
"check": "biome check --write ./src",
|
package/src/upload/errors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Metric } from "effect";
|
|
2
|
-
import type {
|
|
2
|
+
import type { UploadEngineMetrics } from "./metrics.js";
|
|
3
3
|
|
|
4
4
|
// ============================================================================
|
|
5
5
|
// Upload Error Classification and Tracking
|
|
@@ -109,7 +109,7 @@ export const classifyUploadError = (error: unknown): UploadErrorCategory => {
|
|
|
109
109
|
* Track upload errors with metrics and structured logging
|
|
110
110
|
*/
|
|
111
111
|
export const trackUploadError = (
|
|
112
|
-
metrics:
|
|
112
|
+
metrics: UploadEngineMetrics,
|
|
113
113
|
operation: string,
|
|
114
114
|
error: unknown,
|
|
115
115
|
context: Record<string, unknown> = {},
|
package/src/upload/layers.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
makeUploadObservabilityLayer,
|
|
4
4
|
UploadObservability,
|
|
5
5
|
} from "../core/layers.js";
|
|
6
|
-
import {
|
|
6
|
+
import { createUploadEngineMetrics } from "./metrics.js";
|
|
7
7
|
|
|
8
8
|
// ============================================================================
|
|
9
9
|
// Upload Observability Layer Implementation
|
|
@@ -15,7 +15,7 @@ import { createUploadServerMetrics } from "./metrics.js";
|
|
|
15
15
|
export const makeUploadObservabilityLive = (
|
|
16
16
|
serviceName = "uploadista-upload-server",
|
|
17
17
|
): Layer.Layer<UploadObservability> => {
|
|
18
|
-
const metrics =
|
|
18
|
+
const metrics = createUploadEngineMetrics();
|
|
19
19
|
|
|
20
20
|
return Layer.succeed(UploadObservability, {
|
|
21
21
|
serviceName,
|
|
@@ -61,7 +61,7 @@ export const getUploadMetrics = Effect.gen(function* () {
|
|
|
61
61
|
export const withUploadDuration = <A, E, R>(
|
|
62
62
|
effect: Effect.Effect<A, E, R>,
|
|
63
63
|
): Effect.Effect<A, E, R | UploadObservability> => {
|
|
64
|
-
const metrics =
|
|
64
|
+
const metrics = createUploadEngineMetrics();
|
|
65
65
|
return Effect.gen(function* () {
|
|
66
66
|
const startTime = Date.now();
|
|
67
67
|
const result = yield* effect;
|
|
@@ -77,7 +77,7 @@ export const withUploadDuration = <A, E, R>(
|
|
|
77
77
|
export const withChunkDuration = <A, E, R>(
|
|
78
78
|
effect: Effect.Effect<A, E, R>,
|
|
79
79
|
): Effect.Effect<A, E, R> => {
|
|
80
|
-
const metrics =
|
|
80
|
+
const metrics = createUploadEngineMetrics();
|
|
81
81
|
return Effect.gen(function* () {
|
|
82
82
|
const startTime = Date.now();
|
|
83
83
|
const result = yield* effect;
|
package/src/upload/metrics.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Metric, MetricBoundaries } from "effect";
|
|
|
7
7
|
/**
|
|
8
8
|
* Upload server metrics for tracking upload operations
|
|
9
9
|
*/
|
|
10
|
-
export const
|
|
10
|
+
export const createUploadEngineMetrics = () => ({
|
|
11
11
|
// Counter metrics
|
|
12
12
|
uploadCreatedTotal: Metric.counter("upload_created_total", {
|
|
13
13
|
description: "Total number of uploads created",
|
|
@@ -110,9 +110,9 @@ export const createUploadServerMetrics = () => ({
|
|
|
110
110
|
/**
|
|
111
111
|
* Type for upload server metrics
|
|
112
112
|
*/
|
|
113
|
-
export type
|
|
113
|
+
export type UploadEngineMetrics = ReturnType<typeof createUploadEngineMetrics>;
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* Default upload server metrics instance
|
|
117
117
|
*/
|
|
118
|
-
export const
|
|
118
|
+
export const uploadEngineMetrics = createUploadEngineMetrics();
|
package/src/upload/testing.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
2
|
import { UploadObservability } from "../core/layers.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createUploadEngineMetrics } from "./metrics.js";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// ======================== ====================================================
|
|
6
6
|
// Upload Observability Testing Utilities
|
|
7
7
|
// ============================================================================
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@ export const UploadObservabilityTest = Layer.succeed(UploadObservability, {
|
|
|
24
24
|
/**
|
|
25
25
|
* Get metrics for validation (useful for testing metric definitions)
|
|
26
26
|
*/
|
|
27
|
-
export const getTestMetrics = () =>
|
|
27
|
+
export const getTestMetrics = () => createUploadEngineMetrics();
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Validate that all required metrics exist
|