@vizydrop/tracer 3.2.2 → 3.3.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.
package/index.js CHANGED
@@ -1,6 +1,9 @@
1
- const {createTracer} = require(`./src/tracer`);
2
- const express = require(`./src/express`);
3
- const koa = require(`./src/koa`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const {createTracer} = require('./src/tracer');
5
+ const express = require('./src/express');
6
+ const koa = require('./src/koa');
4
7
 
5
8
  module.exports = {
6
9
  createTracer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vizydrop/tracer",
3
3
  "license": "MIT",
4
- "version": "3.2.2",
4
+ "version": "3.3.0",
5
5
  "scripts": {
6
6
  "test": "jest",
7
7
  "lint": "eslint --quiet ."
@@ -19,21 +19,21 @@
19
19
  "lodash": "4.17.21"
20
20
  },
21
21
  "devDependencies": {
22
- "@vizydrop/eslint-config-vizydrop": "6.0.9",
22
+ "@vizydrop/eslint-config-vizydrop": "7.2.3",
23
23
  "eslint": "6.8.0",
24
- "eslint-config-airbnb": "18.0.1",
24
+ "eslint-config-airbnb": "18.1.0",
25
25
  "eslint-config-prettier": "6.10.0",
26
26
  "eslint-plugin-babel": "5.3.0",
27
27
  "eslint-plugin-filenames": "1.3.2",
28
- "eslint-plugin-flowtype": "4.6.0",
29
- "eslint-plugin-import": "2.20.0",
28
+ "eslint-plugin-flowtype": "4.7.0",
29
+ "eslint-plugin-import": "2.22.1",
30
30
  "eslint-plugin-jsx-a11y": "6.2.3",
31
31
  "eslint-plugin-lodash-fp": "2.2.0-a1",
32
- "eslint-plugin-mocha": "6.2.2",
33
- "eslint-plugin-node": "11.0.0",
32
+ "eslint-plugin-mocha": "6.3.0",
33
+ "eslint-plugin-node": "11.1.0",
34
34
  "eslint-plugin-promise": "4.2.1",
35
- "eslint-plugin-react": "7.18.0",
36
- "eslint-plugin-react-hooks": "2.3.0",
35
+ "eslint-plugin-react": "7.19.0",
36
+ "eslint-plugin-react-hooks": "2.5.0",
37
37
  "jest": "25.1.0"
38
38
  },
39
39
  "jest": {
@@ -1,11 +1,14 @@
1
- const defaultOptions = {
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const defaultOptions = {
2
5
  enabled: true,
3
6
  metricsIntervalMillis: 1000,
4
7
  ignoreUrls: [
5
8
  /[a-z ]*\/metrics(,\/_prometheus\/metrics){0,1}.*/,
6
9
  /\/assets\/.*/,
7
10
  /\/favicon.*/,
8
- `/api/v1/status`,
11
+ '/api/v1/status',
9
12
  /[a-z ]*\/status/,
10
13
  ]
11
14
  };
@@ -1,15 +1,18 @@
1
- const { trace } = require(`@opentelemetry/api`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const { trace } = require('@opentelemetry/api');
2
5
 
3
6
  const captureCorrelationIdMiddleware = (getCorrelationId) => {
4
- if (!getCorrelationId && typeof getCorrelationId !== `function`) {
5
- throw new Error(`getCorrelationId expect to be a function`);
7
+ if (!getCorrelationId && typeof getCorrelationId !== 'function') {
8
+ throw new Error('getCorrelationId expect to be a function');
6
9
  }
7
10
 
8
11
  return (req, res, next) => {
9
12
  const currentSpan = trace.getActiveSpan();
10
13
 
11
14
  if (currentSpan) {
12
- currentSpan.setAttribute(`correlationId`, getCorrelationId(req));
15
+ currentSpan.setAttribute('correlationId', getCorrelationId(req));
13
16
  }
14
17
 
15
18
  next();
@@ -1,4 +1,7 @@
1
- const {captureCorrelationIdMiddleware} = require(`./captureCorrelationIdMiddleware`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const {captureCorrelationIdMiddleware} = require('./captureCorrelationIdMiddleware');
2
5
 
3
6
  module.exports = {
4
7
  captureCorrelationIdMiddleware,
@@ -1,15 +1,18 @@
1
- const { trace } = require(`@opentelemetry/api`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const { trace } = require('@opentelemetry/api');
2
5
 
3
6
  const captureCorrelationIdMiddleware = (getCorrelationId) => {
4
- if (!getCorrelationId && typeof getCorrelationId !== `function`) {
5
- throw new Error(`getCorrelationId expect to be a function`);
7
+ if (!getCorrelationId && typeof getCorrelationId !== 'function') {
8
+ throw new Error('getCorrelationId expect to be a function');
6
9
  }
7
10
 
8
11
  return async (ctx, next) => {
9
12
  const currentSpan = trace.getActiveSpan();
10
13
 
11
14
  if (currentSpan) {
12
- currentSpan.setAttribute(`correlationId`, getCorrelationId(ctx.request));
15
+ currentSpan.setAttribute('correlationId', getCorrelationId(ctx.request));
13
16
  }
14
17
 
15
18
  await next();
package/src/koa/index.js CHANGED
@@ -1,4 +1,7 @@
1
- const {captureCorrelationIdMiddleware} = require(`./captureCorrelationIdMiddleware`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const {captureCorrelationIdMiddleware} = require('./captureCorrelationIdMiddleware');
2
5
 
3
6
  module.exports = {
4
7
  captureCorrelationIdMiddleware,
@@ -1,4 +1,7 @@
1
- const _ = require(`lodash/fp`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const _ = require('lodash/fp');
2
5
 
3
6
  function replaceSensitiveData(text) {
4
7
  if (!text) {
@@ -17,7 +20,7 @@ function replaceSensitiveData(text) {
17
20
 
18
21
  if (matches) {
19
22
  return _.tail(matches).reduce(
20
- (res, match) => res.replace(match, `********`),
23
+ (res, match) => res.replace(match, '********'),
21
24
  result,
22
25
  );
23
26
  }
package/src/tracer.js CHANGED
@@ -1,19 +1,22 @@
1
- const { trace } = require(`@opentelemetry/api`);
2
- const { NodeSDK } = require(`@opentelemetry/sdk-node`);
3
- const { ConsoleSpanExporter } = require(`@opentelemetry/sdk-trace-node`);
4
- const { Resource } = require(`@opentelemetry/resources`);
5
- const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = require(`@opentelemetry/semantic-conventions`);
6
- const { getNodeAutoInstrumentations } = require(`@opentelemetry/auto-instrumentations-node`);
7
- const { OTLPTraceExporter } = require(`@opentelemetry/exporter-trace-otlp-grpc`);
8
- const { OTLPMetricExporter } = require(`@opentelemetry/exporter-metrics-otlp-grpc`);
9
- const { PeriodicExportingMetricReader, ConsoleMetricExporter } = require(`@opentelemetry/sdk-metrics`);
10
- const { replaceSensitiveData, buildIgnoredUrlMatcher } = require(`./requestFilters`);
11
- const { addDefaultOptions } = require(`./defaultOptions`);
1
+ /*********************************************************************
2
+ * © Copyright IBM Corp. 2025
3
+ *********************************************************************/
4
+ const { trace } = require('@opentelemetry/api');
5
+ const { NodeSDK } = require('@opentelemetry/sdk-node');
6
+ const { ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-node');
7
+ const { Resource } = require('@opentelemetry/resources');
8
+ const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = require('@opentelemetry/semantic-conventions');
9
+ const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
10
+ const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');
11
+ const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
12
+ const { PeriodicExportingMetricReader, ConsoleMetricExporter } = require('@opentelemetry/sdk-metrics');
13
+ const { replaceSensitiveData, buildIgnoredUrlMatcher } = require('./requestFilters');
14
+ const { addDefaultOptions } = require('./defaultOptions');
12
15
 
13
16
  const ResourceAttributes = {
14
- TpClusterName: `tp_cluster`,
15
- DatadogEnvironment: `tags.datadoghq.com/env `,
16
- Environment: `deployment.environment`
17
+ TpClusterName: 'tp_cluster',
18
+ DatadogEnvironment: 'tags.datadoghq.com/env ',
19
+ Environment: 'deployment.environment'
17
20
  };
18
21
 
19
22
  const createOpenTelemetryAgent = ({
@@ -1,26 +0,0 @@
1
- name: Node CI
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
9
-
10
- strategy:
11
- matrix:
12
- node-version: [10.x, 12.x]
13
-
14
- steps:
15
- - uses: actions/checkout@v1
16
- - name: Use Node.js ${{ matrix.node-version }}
17
- uses: actions/setup-node@v1
18
- with:
19
- node-version: ${{ matrix.node-version }}
20
- - name: yarn install, lint, and test
21
- run: |
22
- yarn install
23
- yarn lint
24
- yarn test
25
- env:
26
- CI: true
package/.gitlab-ci.yml DELETED
@@ -1,50 +0,0 @@
1
- stages:
2
- - prepare
3
- - tests
4
- - publish
5
-
6
- variables:
7
- VERSION_OUTPUT_PATH: version.txt
8
-
9
- prepare:version:
10
- stage: prepare
11
- image: apptiouw2.jfrog.io/targetprocess-docker/gitversion:latest
12
- script:
13
- - git-version '/showvariable' SemVer | tee ${VERSION_OUTPUT_PATH}
14
- artifacts:
15
- expire_in: 2 days
16
- paths:
17
- - ${VERSION_OUTPUT_PATH}
18
-
19
- tests:
20
- stage: tests
21
- image: node:16-alpine
22
- needs: []
23
- before_script:
24
- - yarn install
25
- script:
26
- - npm run lint
27
- - npm run test
28
- cache:
29
- key: "node_modules"
30
- policy: pull # remove this to invalidate cache
31
- paths:
32
- - node_modules/
33
-
34
- publish:npm:
35
- stage: publish
36
- dependencies:
37
- - prepare:version
38
- needs:
39
- - tests
40
- - prepare:version
41
- image: node:12-alpine
42
- rules:
43
- - if: $PUBLISH
44
- - if: $CI_COMMIT_TAG
45
- before_script:
46
- script:
47
- - APP_VERSION=`cat ${VERSION_OUTPUT_PATH}`
48
- - sed "s/999.999.999/$APP_VERSION/g" "package.json" > temp_package.json && mv temp_package.json "package.json"
49
- - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ~/.npmrc
50
- - npm publish
package/GitVersion.yml DELETED
@@ -1,4 +0,0 @@
1
- mode: ContinuousDeployment
2
- branches: {}
3
- ignore:
4
- sha: []
package/version.txt DELETED
@@ -1 +0,0 @@
1
- 3.2.2