@devopsplaybook.io/otel-utils 1.1.0 → 1.1.1

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/eslint.config.mjs CHANGED
@@ -4,7 +4,8 @@ import eslint from "@eslint/js";
4
4
  import tseslint from "typescript-eslint";
5
5
 
6
6
  export default tseslint.config(
7
+ { ignores: ["dist/", "node_modules/"] },
7
8
  eslint.configs.recommended,
8
9
  ...tseslint.configs.strict,
9
- ...tseslint.configs.stylistic
10
+ ...tseslint.configs.stylistic,
10
11
  );
package/jest.config.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ moduleFileExtensions: ["ts", "js"],
3
+ transform: {
4
+ "^.+\\.(ts|tsx)$": [
5
+ "ts-jest",
6
+ {
7
+ tsconfig: "tsconfig.spec.json",
8
+ },
9
+ ],
10
+ },
11
+ testMatch: ["/**/src/**/*.spec.(ts|js)"],
12
+ testPathIgnorePatterns: ["/node_modules/", "/dist/"],
13
+ testEnvironment: "node",
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/otel-utils",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Utility to simplify integration with Open Telemetry",
5
5
  "keywords": [
6
6
  "Open",
@@ -16,34 +16,40 @@
16
16
  "types": "dist/index.d.ts",
17
17
  "scripts": {
18
18
  "build": "tsc",
19
+ "lint": "eslint src",
20
+ "test": "jest --coverage",
19
21
  "dependencies": ""
20
22
  },
21
23
  "dependencies": {
22
24
  "@opentelemetry/api": "^1.9.1",
23
- "@opentelemetry/api-logs": "^0.218.0",
24
- "@opentelemetry/auto-instrumentations-node": "^0.76.0",
25
- "@opentelemetry/context-async-hooks": "^2.7.1",
26
- "@opentelemetry/core": "^2.7.1",
27
- "@opentelemetry/exporter-logs-otlp-http": "^0.218.0",
28
- "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
29
- "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
25
+ "@opentelemetry/api-logs": "^0.219.0",
26
+ "@opentelemetry/auto-instrumentations-node": "^0.77.0",
27
+ "@opentelemetry/context-async-hooks": "^2.8.0",
28
+ "@opentelemetry/core": "^2.8.0",
29
+ "@opentelemetry/exporter-logs-otlp-http": "^0.219.0",
30
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.219.0",
31
+ "@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
30
32
  "@opentelemetry/id-generator-aws-xray": "^2.1.0",
31
- "@opentelemetry/resources": "^2.7.1",
32
- "@opentelemetry/sdk-logs": "^0.218.0",
33
- "@opentelemetry/sdk-metrics": "^2.7.1",
34
- "@opentelemetry/sdk-node": "^0.218.0",
35
- "@opentelemetry/sdk-trace-base": "^2.7.1",
36
- "@opentelemetry/sdk-trace-node": "^2.7.1",
37
- "@opentelemetry/sdk-trace-web": "^2.7.1",
33
+ "@opentelemetry/resources": "^2.8.0",
34
+ "@opentelemetry/sdk-logs": "^0.219.0",
35
+ "@opentelemetry/sdk-metrics": "^2.8.0",
36
+ "@opentelemetry/sdk-node": "^0.219.0",
37
+ "@opentelemetry/sdk-trace-base": "^2.8.0",
38
+ "@opentelemetry/sdk-trace-node": "^2.8.0",
39
+ "@opentelemetry/sdk-trace-web": "^2.8.0",
38
40
  "@opentelemetry/semantic-conventions": "^1.41.1"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@eslint/js": "^10.0.1",
42
- "@types/node": "^25.9.1",
44
+ "@types/jest": "^30.0.0",
45
+ "@types/node": "^26.0.1",
43
46
  "@types/sqlite3": "^5.1.0",
47
+ "eslint": "^10.5.0",
48
+ "jest": "^30.4.2",
49
+ "ts-jest": "^29.4.11",
44
50
  "ts-node": "^10.9.2",
45
- "typescript-eslint": "^8.59.4",
46
- "typescript": "^6.0.3"
51
+ "typescript": "^6.0.3",
52
+ "typescript-eslint": "^8.62.0"
47
53
  },
48
54
  "publishConfig": {
49
55
  "access": "public"
@@ -0,0 +1,20 @@
1
+ import { createOTelResource } from "./utils/createResource";
2
+ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION, ATTR_NETWORK_LOCAL_ADDRESS } from "@opentelemetry/semantic-conventions";
3
+
4
+ describe("createOTelResource", () => {
5
+ it("should create a resource with the provided service name and version", () => {
6
+ const resource = createOTelResource("test-service", "1.0.0");
7
+ const attrs = resource.attributes;
8
+
9
+ expect(attrs[ATTR_SERVICE_NAME]).toBe("test-service");
10
+ expect(attrs[ATTR_SERVICE_VERSION]).toBe("1.0.0");
11
+ });
12
+
13
+ it("should include the local hostname as network local address", () => {
14
+ const resource = createOTelResource("test-service", "1.0.0");
15
+ const attrs = resource.attributes;
16
+
17
+ expect(attrs[ATTR_NETWORK_LOCAL_ADDRESS]).toBeDefined();
18
+ expect(typeof attrs[ATTR_NETWORK_LOCAL_ADDRESS]).toBe("string");
19
+ });
20
+ });
package/tsconfig.json CHANGED
@@ -9,5 +9,6 @@
9
9
  "skipLibCheck": true,
10
10
  "forceConsistentCasingInFileNames": true
11
11
  },
12
- "include": ["index.ts", "src/**/*"]
12
+ "include": ["index.ts", "src/**/*"],
13
+ "exclude": ["src/**/*.spec.ts"]
13
14
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["jest", "node"]
5
+ },
6
+ "include": ["src/**/*.spec.ts"]
7
+ }
@@ -1,16 +0,0 @@
1
- name: NPM Upgrade
2
-
3
- on:
4
- schedule:
5
- - cron: "0 6 * * 1"
6
-
7
- workflow_dispatch:
8
-
9
- jobs:
10
- npm-upgrade:
11
- uses: devopsplaybook-io/common-utils/.github/workflows/reusable-npm-upgrade.yml@main
12
- permissions:
13
- contents: write
14
- pull-requests: write
15
- with:
16
- npm_services: '[]'