@opentelemetry/instrumentation-pino
Advanced tools
Comparing version 0.28.1 to 0.29.0
@@ -33,3 +33,5 @@ "use strict"; | ||
if (args.length == 0) { | ||
return pinoModule({ mixin: instrumentation._getMixinFunction() }); | ||
return pinoModule({ | ||
mixin: instrumentation._getMixinFunction(), | ||
}); | ||
} | ||
@@ -60,3 +62,3 @@ if (args.length == 1) { | ||
} | ||
_callHook(span, record) { | ||
_callHook(span, record, level) { | ||
const hook = this.getConfig().logHook; | ||
@@ -66,3 +68,3 @@ if (!hook) { | ||
} | ||
instrumentation_1.safeExecuteInTheMiddle(() => hook(span, record), err => { | ||
instrumentation_1.safeExecuteInTheMiddle(() => hook(span, record, level), err => { | ||
if (err) { | ||
@@ -75,3 +77,3 @@ api_1.diag.error('pino instrumentation: error calling logHook', err); | ||
const instrumentation = this; | ||
return function otelMixin() { | ||
return function otelMixin(_context, level) { | ||
if (!instrumentation.isEnabled()) { | ||
@@ -93,3 +95,3 @@ return {}; | ||
}; | ||
instrumentation._callHook(span, record); | ||
instrumentation._callHook(span, record, level); | ||
return record; | ||
@@ -108,4 +110,4 @@ }; | ||
const otelMixin = this._getMixinFunction(); | ||
options.mixin = () => { | ||
return Object.assign(otelMixin(), originalMixin()); | ||
options.mixin = (context, level) => { | ||
return Object.assign(otelMixin(context, level), originalMixin(context, level)); | ||
}; | ||
@@ -112,0 +114,0 @@ return options; |
import { Span } from '@opentelemetry/api'; | ||
import { InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
import type { pino } from 'pino'; | ||
export declare type LogHookFunction = (span: Span, record: Record<string, any>) => void; | ||
export declare type LogHookFunction = (span: Span, record: Record<string, any>, level?: number) => void; | ||
export interface PinoInstrumentationConfig extends InstrumentationConfig { | ||
@@ -6,0 +6,0 @@ logHook?: LogHookFunction; |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.28.1"; | ||
export declare const VERSION = "0.29.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.28.1'; | ||
exports.VERSION = '0.29.0'; | ||
//# sourceMappingURL=version.js.map |
# Changelog | ||
## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-pino-v0.28.1...instrumentation-pino-v0.29.0) (2022-05-14) | ||
### Features | ||
* add supported node versions for all packages ([#973](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/973)) ([baaacbd](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/baaacbdd35ca4baab0afae64647aa8c0380ee4b7)) | ||
* send log level to pino hook ([#967](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/967)) ([cfb0b7a](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/cfb0b7a4ffe508563e383b7a186d438186b5c518)) | ||
* use Otel SDK 1.2/0.28 ([#984](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/984)) ([098c2ed](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/098c2ed6f9c5ab7bd865685018c0777245aab3b7)) | ||
### [0.28.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-pino-v0.28.0...instrumentation-pino-v0.28.1) (2022-01-24) | ||
@@ -4,0 +13,0 @@ |
{ | ||
"name": "@opentelemetry/instrumentation-pino", | ||
"version": "0.28.1", | ||
"version": "0.29.0", | ||
"description": "OpenTelemetry instrumentation for pino", | ||
@@ -15,8 +15,7 @@ "main": "build/src/index.js", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"precompile": "tsc --version && lerna run version --scope @opentelemetry/instrumentation-pino --include-dependencies", | ||
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-pino --include-dependencies", | ||
"prewatch": "npm run precompile", | ||
"prepare": "npm run compile", | ||
"version:update": "node ../../../scripts/version-update.js", | ||
"compile": "npm run version:update && tsc -p ." | ||
"compile": "tsc -p ." | ||
}, | ||
@@ -35,3 +34,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=8.5.0" | ||
"node": ">=12.0.0" | ||
}, | ||
@@ -50,14 +49,13 @@ "files": [ | ||
"peerDependencies": { | ||
"@opentelemetry/api": "^1.0.2" | ||
"@opentelemetry/api": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@opentelemetry/api": "1.0.2", | ||
"@opentelemetry/context-async-hooks": "1.0.1", | ||
"@opentelemetry/sdk-trace-base": "1.0.1", | ||
"@opentelemetry/sdk-trace-node": "1.0.1", | ||
"@opentelemetry/api": "^1.0.0", | ||
"@opentelemetry/context-async-hooks": "1.2.0", | ||
"@opentelemetry/sdk-trace-base": "1.2.0", | ||
"@opentelemetry/sdk-trace-node": "1.2.0", | ||
"@types/mocha": "7.0.2", | ||
"@types/node": "14.17.9", | ||
"@types/node": "16.11.21", | ||
"@types/semver": "7.3.8", | ||
"@types/sinon": "10.0.2", | ||
"codecov": "3.8.3", | ||
"gts": "3.1.0", | ||
@@ -67,3 +65,3 @@ "mocha": "7.2.0", | ||
"rimraf": "3.0.2", | ||
"sinon": "12.0.1", | ||
"sinon": "13.0.1", | ||
"test-all-versions": "5.0.1", | ||
@@ -74,7 +72,7 @@ "ts-mocha": "8.0.0", | ||
"dependencies": { | ||
"@opentelemetry/instrumentation": "^0.27.0", | ||
"pino": "7.2.0", | ||
"@opentelemetry/instrumentation": "^0.28.0", | ||
"pino": "7.10.0", | ||
"semver": "^7.3.5" | ||
}, | ||
"gitHead": "edfc04cbe3e7faaa365724ddc26bf702b68cc008" | ||
"gitHead": "f89da7d080d2aaecacd8728d647e8eff4c9248a9" | ||
} |
# OpenTelemetry instrumentation for pino | ||
[![NPM Published Version][npm-img]][npm-url] | ||
[![dependencies][dependencies-image]][dependencies-url] | ||
[![devDependencies][devDependencies-image]][devDependencies-url] | ||
[![Apache License][license-image]][license-image] | ||
@@ -32,3 +30,3 @@ | ||
// Optional hook to insert additional context to log object. | ||
logHook: (span, record) => { | ||
logHook: (span, record, level) => { | ||
record['resource.service.name'] = provider.resource.attributes['service.name']; | ||
@@ -74,7 +72,3 @@ }, | ||
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat | ||
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-pino | ||
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-pino | ||
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-contrib.svg?path=plugins%2Fnode%2Fopentelemetry-instrumentation-pino&type=dev | ||
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-contrib?path=plugins%2Fnode%2Fopentelemetry-instrumentation-pino&type=dev | ||
[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-pino | ||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-pino.svg |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30281
16
198
73
+ Added@opentelemetry/api-metrics@0.28.0(transitive)
+ Added@opentelemetry/instrumentation@0.28.0(transitive)
+ Addedpino@7.10.0(transitive)
+ Addedprocess-warning@1.0.0(transitive)
+ Addedthread-stream@0.15.2(transitive)
- Removed@opentelemetry/api-metrics@0.27.0(transitive)
- Removed@opentelemetry/instrumentation@0.27.0(transitive)
- Removedfastify-warning@0.2.0(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedpino@7.2.0(transitive)
- Removedthread-stream@0.13.2(transitive)
Updatedpino@7.10.0