@hkube/metrics 1.0.43 → 1.0.45
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/.github/workflows/main.yml +27 -23
- package/lib/schema.js +2 -1
- package/lib/tracer.js +13 -0
- package/package.json +5 -1
- package/test/tracerTest.js +20 -0
|
@@ -34,26 +34,30 @@ jobs:
|
|
|
34
34
|
with:
|
|
35
35
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
36
36
|
publish:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
37
|
+
if: github.ref == 'refs/heads/master'
|
|
38
|
+
needs: test
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
#Needed for OIDC - Npm repo publishing
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
contents: write
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v2
|
|
46
|
+
- name: setup git
|
|
47
|
+
run: |
|
|
48
|
+
git config --local user.email "action@github.com"
|
|
49
|
+
git config --local user.name "GitHub Action"
|
|
50
|
+
- name: version
|
|
51
|
+
run: |
|
|
52
|
+
git checkout -f -b version-branch
|
|
53
|
+
npm version patch --no-commit-hooks -m "$(git log -1 --pretty=%B) .... bump version [skip ci]"
|
|
54
|
+
git push origin version-branch:master --follow-tags
|
|
55
|
+
- uses: actions/setup-node@v4 # Use v4 for OIDC support
|
|
56
|
+
with:
|
|
57
|
+
node-version: 24 # Use a modern Node version
|
|
58
|
+
registry-url: https://registry.npmjs.org
|
|
59
|
+
scope: '@hkube'
|
|
60
|
+
- name: Enable provenance
|
|
61
|
+
run: npm config set provenance true
|
|
62
|
+
- name: Publish to npm
|
|
63
|
+
run: NODE_AUTH_TOKEN="" npm publish --access public --loglevel verbose
|
package/lib/schema.js
CHANGED
|
@@ -121,7 +121,8 @@ const tracerSchema = {
|
|
|
121
121
|
logSpans: { type: 'boolean' },
|
|
122
122
|
agentHost: { type: 'string', default: 'localhost' },
|
|
123
123
|
agentPort: { type: ['number', 'string'], default: 6832 },
|
|
124
|
-
|
|
124
|
+
queueSize: { type: 'number', default: 2000 },
|
|
125
|
+
flushIntervalMs: { type: 'number', default: 1000 }
|
|
125
126
|
},
|
|
126
127
|
default: {},
|
|
127
128
|
additionalProperties: false
|
package/lib/tracer.js
CHANGED
|
@@ -121,6 +121,19 @@ class Tracer {
|
|
|
121
121
|
return span;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
close() {
|
|
125
|
+
return new Promise((resolve) => {
|
|
126
|
+
if (!this._tracer) {
|
|
127
|
+
resolve();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this._tracer.close(() => {
|
|
131
|
+
this._tracer = null;
|
|
132
|
+
resolve();
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
124
137
|
get parentRelationships() {
|
|
125
138
|
return parentRelationships;
|
|
126
139
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hkube/metrics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/kube-HPC/metrics.hkube.git"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"test": "NODE_ENV=test node_modules/mocha/bin/mocha test --colors --recursive --exit",
|
|
8
12
|
"test-travis": "NODE_ENV=test ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec test --exit",
|
package/test/tracerTest.js
CHANGED
|
@@ -69,6 +69,26 @@ describe('Tracer', () => {
|
|
|
69
69
|
const moreTracer = await tracer.createTracer('moreTracer', {});
|
|
70
70
|
expect(moreTracer._tracer._serviceName).to.equal('moreTracer');
|
|
71
71
|
});
|
|
72
|
+
|
|
73
|
+
it('should close tracer', async () => {
|
|
74
|
+
await tracer.init({
|
|
75
|
+
tracerConfig: {
|
|
76
|
+
serviceName: 'test',
|
|
77
|
+
},
|
|
78
|
+
tracerOptions: {
|
|
79
|
+
reporter: new InMemoryReporter()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
});
|
|
83
|
+
expect(tracer._tracer).to.exist;
|
|
84
|
+
await tracer.close();
|
|
85
|
+
expect(tracer._tracer).to.not.exist;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should close without tracer', async () => {
|
|
89
|
+
await tracer.close();
|
|
90
|
+
expect(tracer._tracer).to.not.exist;
|
|
91
|
+
});
|
|
72
92
|
});
|
|
73
93
|
describe('Span', () => {
|
|
74
94
|
it('should throw without options', async () => {
|