otel-express-collector 1.0.0

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.
@@ -0,0 +1,49 @@
1
+ export interface CollectorConfig {
2
+ serviceName: string;
3
+ serviceVersion: string;
4
+ otlpEndpoint?: string;
5
+ tracesEndpoint?: string;
6
+ metricsEndpoint?: string;
7
+ logsEndpoint?: string;
8
+ enableLogging?: boolean;
9
+ enableMetrics?: boolean;
10
+ enableTracing?: boolean;
11
+ resourceAttributes?: Record<string, string | number | boolean>;
12
+ instrumentations?: string[];
13
+ metricExportInterval?: number;
14
+ logBatchSize?: number;
15
+ enableConsoleExport?: boolean;
16
+ }
17
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
18
+ export interface LogEntry {
19
+ message: string;
20
+ level: LogLevel;
21
+ attributes?: Record<string, any>;
22
+ }
23
+ export interface HttpRequestMetrics {
24
+ method: string;
25
+ route: string;
26
+ statusCode: number;
27
+ duration: number;
28
+ }
29
+ export interface DatabaseMetrics {
30
+ queryType: string;
31
+ success: boolean;
32
+ duration: number;
33
+ database?: string;
34
+ collection?: string;
35
+ }
36
+ export interface BusinessMetrics {
37
+ eventType: string;
38
+ count?: number;
39
+ attributes?: Record<string, any>;
40
+ }
41
+ export interface HealthStatus {
42
+ status: 'healthy' | 'unhealthy';
43
+ timestamp: string;
44
+ service: string;
45
+ version: string;
46
+ uptime: number;
47
+ dependencies?: Record<string, 'healthy' | 'unhealthy'>;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MA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W,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;CACxD"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "otel-express-collector",
3
+ "version": "1.0.0",
4
+ "description": "Comprehensive OpenTelemetry instrumentation package for Node.js Express microservices",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc -w",
15
+ "test": "jest",
16
+ "lint": "eslint src/**/*.ts",
17
+ "prepublishOnly": "npm run build && npm test",
18
+ "example": "ts-node examples/basic-usage.ts",
19
+ "clean": "rm -rf dist node_modules package-lock.json && npm install"
20
+ },
21
+ "devDependencies": {
22
+ "@types/express": "^4.17.0",
23
+ "@types/jest": "^29.0.0",
24
+ "@types/node": "^20.0.0",
25
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
26
+ "@typescript-eslint/parser": "^6.0.0",
27
+ "eslint": "^8.0.0",
28
+ "jest": "^29.0.0",
29
+ "ts-jest": "^29.0.0",
30
+ "ts-node": "^10.9.0",
31
+ "typescript": "^5.0.0"
32
+ },
33
+ "keywords": [
34
+ "opentelemetry",
35
+ "observability",
36
+ "monitoring",
37
+ "logging",
38
+ "metrics",
39
+ "tracing",
40
+ "express",
41
+ "microservices"
42
+ ],
43
+ "author": "ABhay",
44
+ "license": "MIT",
45
+ "homepage": "https://github.com/your-org/otel-express-collector#readme",
46
+ "engines": {
47
+ "node": ">=20.0.0"
48
+ },
49
+ "dependencies": {
50
+ "@opentelemetry/auto-instrumentations-node": "^0.67.3",
51
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.209.0",
52
+ "@opentelemetry/sdk-node": "^0.209.0",
53
+ "winston": "^3.19.0"
54
+ }
55
+ }