@opentelemetry/instrumentation-winston 0.47.0 → 0.48.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/README.md CHANGED
@@ -38,11 +38,10 @@ const tracerProvider = new NodeTracerProvider();
38
38
  tracerProvider.register();
39
39
 
40
40
  // To start a logger, you first need to initialize the Logger provider.
41
- const loggerProvider = new LoggerProvider();
42
- // Add a processor to export log record
43
- loggerProvider.addLogRecordProcessor(
44
- new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
45
- );
41
+ // Add a processor to export log record.
42
+ const loggerProvider = new LoggerProvider({
43
+ processors: [new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())],
44
+ });
46
45
  logsAPI.logs.setGlobalLoggerProvider(loggerProvider);
47
46
 
48
47
  registerInstrumentations({
@@ -122,11 +121,10 @@ const winston = require('winston');
122
121
 
123
122
 
124
123
  // To start a logger, you first need to initialize the Logger provider.
125
- const loggerProvider = new LoggerProvider();
126
124
  // Add a processor to export log record
127
- loggerProvider.addLogRecordProcessor(
128
- new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
129
- );
125
+ const loggerProvider = new LoggerProvider({
126
+ processors: [new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())],
127
+ });
130
128
  logsAPI.logs.setGlobalLoggerProvider(loggerProvider);
131
129
 
132
130
  const logger = winston.createLogger({
@@ -139,7 +137,25 @@ const logger = winston.createLogger({
139
137
  ```
140
138
 
141
139
  > [!IMPORTANT]
142
- > Logs will be duplicated if `@opentelemetry/winston-transport` is added as a transport in `winston` and `@opentelemetry/instrumentation-winston` is configured with `disableLogSending: false`.
140
+ > Logs will be **duplicated** if `OpenTelemetryTransportV3` is explicitly added as a Winston logger transport **and** `@opentelemetry/instrumentation-winston` is active with the [Log sending](#log-sending) feature (the default). If you are both using `OpenTelemetryTransportV3` and instrumentation-winston, be sure to either disable instrumentation-winston completely, or disable its Log sending feature (`disableLogSending: false`). For example:
141
+ >
142
+ > ```js
143
+ > const { WinstonInstrumentation } = require('@opentelemetry/instrumentation-winston');
144
+ > const { registerInstrumentations } = require('@opentelemetry/instrumentation');
145
+ > registerInstrumentations({
146
+ > instrumentations: [
147
+ > new WinstonInstrumentation({
148
+ > disableLogSending: true
149
+ > }),
150
+ > ],
151
+ > });
152
+ > const { OpenTelemetryTransportV3 } = require('@opentelemetry/winston-transport');
153
+ > // Winston import must be after the WinstonInstrumentation creation
154
+ > const winston = require('winston');
155
+ >
156
+ > // ...
157
+ > const logger = winston.createLogger(...);
158
+ > ```
143
159
 
144
160
  ## Semantic Conventions
145
161
 
@@ -1,3 +1,3 @@
1
- export declare const PACKAGE_VERSION = "0.47.0";
1
+ export declare const PACKAGE_VERSION = "0.48.1";
2
2
  export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-winston";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -17,6 +17,6 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.PACKAGE_VERSION = '0.47.0';
20
+ exports.PACKAGE_VERSION = '0.48.1';
21
21
  exports.PACKAGE_NAME = '@opentelemetry/instrumentation-winston';
22
22
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const PACKAGE_VERSION = '0.47.0';\nexport const PACKAGE_NAME = '@opentelemetry/instrumentation-winston';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const PACKAGE_VERSION = '0.48.1';\nexport const PACKAGE_NAME = '@opentelemetry/instrumentation-winston';\n"]}
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@opentelemetry/instrumentation-winston",
3
- "version": "0.47.0",
3
+ "version": "0.48.1",
4
4
  "description": "OpenTelemetry instrumentation for `winston` logger",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
7
- "repository": "open-telemetry/opentelemetry-js-contrib",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/open-telemetry/opentelemetry-js-contrib.git",
10
+ "directory": "packages/instrumentation-winston"
11
+ },
8
12
  "scripts": {
9
- "test": "npm run test-v1-v2 && npm run test-v3 && nyc merge .nyc_output ./coverage/coverage-final.json",
10
- "test-v1-v2": "tav winston 2.4.7 npm run test-run",
11
- "test-v3": "npm run test-run",
12
- "test-run": "nyc --no-clean mocha 'test/**/*.test.ts'",
13
- "test-all-versions": "tav",
14
- "tdd": "npm run test-run -- --watch-extensions ts --watch",
15
13
  "clean": "rimraf build/*",
14
+ "compile": "tsc -p .",
15
+ "compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-winston",
16
16
  "lint": "eslint . --ext .ts",
17
17
  "lint:fix": "eslint . --ext .ts --fix",
18
- "lint:readme": "node ../../../scripts/lint-readme.js",
18
+ "lint:readme": "node ../../scripts/lint-readme.js",
19
19
  "prepublishOnly": "npm run compile",
20
- "version:update": "node ../../../scripts/version-update.js",
21
- "setup:dev": "nx run-many -t compile -p @opentelemetry/instrumentation-winston",
22
- "compile": "tsc -p ."
20
+ "test": "nyc mocha 'test/**/*.test.ts'",
21
+ "test-all-versions": "tav",
22
+ "version:update": "node ../../scripts/version-update.js"
23
23
  },
24
24
  "keywords": [
25
25
  "instrumentation",
@@ -51,7 +51,7 @@
51
51
  "@opentelemetry/context-async-hooks": "^2.0.0",
52
52
  "@opentelemetry/sdk-trace-base": "^2.0.0",
53
53
  "@opentelemetry/sdk-trace-node": "^2.0.0",
54
- "@opentelemetry/winston-transport": "^0.13.0",
54
+ "@opentelemetry/winston-transport": "^0.14.1",
55
55
  "@types/mocha": "10.0.10",
56
56
  "@types/node": "18.18.14",
57
57
  "@types/sinon": "17.0.4",
@@ -65,9 +65,9 @@
65
65
  "winston2": "npm:winston@2.4.7"
66
66
  },
67
67
  "dependencies": {
68
- "@opentelemetry/api-logs": "^0.202.0",
69
- "@opentelemetry/instrumentation": "^0.202.0"
68
+ "@opentelemetry/api-logs": "^0.203.0",
69
+ "@opentelemetry/instrumentation": "^0.203.0"
70
70
  },
71
- "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-winston#readme",
72
- "gitHead": "7481f71d615acf161b5c86dd4abce1434a860a3d"
71
+ "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-winston#readme",
72
+ "gitHead": "aca1437f8ce0315b3941460063311bb8332020b8"
73
73
  }