Socket
Socket
Sign inDemoInstall

@opentelemetry/instrumentation-pino

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-pino - npm Package Compare versions

Comparing version 0.34.5 to 0.35.0

13

build/src/instrumentation.js

@@ -23,2 +23,7 @@ "use strict";

const pinoVersions = ['>=5.14.0 <9'];
const DEFAULT_LOG_KEYS = {
traceId: 'trace_id',
spanId: 'span_id',
traceFlags: 'trace_flags',
};
class PinoInstrumentation extends instrumentation_1.InstrumentationBase {

@@ -92,2 +97,3 @@ constructor(config = {}) {

return function otelMixin(_context, level) {
var _a;
if (!instrumentation.isEnabled()) {

@@ -104,6 +110,7 @@ return {};

}
const logKeys = (_a = instrumentation.getConfig().logKeys) !== null && _a !== void 0 ? _a : DEFAULT_LOG_KEYS;
const record = {
trace_id: spanContext.traceId,
span_id: spanContext.spanId,
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
[logKeys.traceId]: spanContext.traceId,
[logKeys.spanId]: spanContext.spanId,
[logKeys.traceFlags]: `0${spanContext.traceFlags.toString(16)}`,
};

@@ -110,0 +117,0 @@ instrumentation._callHook(span, record, level);

@@ -6,3 +6,9 @@ import { Span } from '@opentelemetry/api';

logHook?: LogHookFunction;
/** Configure the names of field injected into logs when there is span context available. */
logKeys?: {
traceId: string;
spanId: string;
traceFlags: string;
};
}
//# sourceMappingURL=types.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.34.5";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.34.5';
exports.VERSION = '0.35.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/instrumentation-pino",
"version": "0.34.5",
"version": "0.35.0",
"description": "OpenTelemetry instrumentation for pino",

@@ -49,3 +49,3 @@ "main": "build/src/index.js",

"@opentelemetry/context-async-hooks": "^1.8.0",
"@opentelemetry/contrib-test-utils": "^0.35.1",
"@opentelemetry/contrib-test-utils": "^0.36.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",

@@ -68,6 +68,6 @@ "@opentelemetry/sdk-trace-node": "^1.8.0",

"dependencies": {
"@opentelemetry/instrumentation": "^0.46.0"
"@opentelemetry/instrumentation": "^0.48.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-pino#readme",
"gitHead": "90928231259bbbdf6980f184bc7420503048b77e"
"gitHead": "32204a362d9dffd4cd69a1300e1f7d245df9df52"
}

@@ -33,4 +33,12 @@ # OpenTelemetry instrumentation for pino

logHook: (span, record, level) => {
record['resource.service.name'] = provider.resource.attributes['service.name'];
record['resource.service.name'] =
provider.resource.attributes['service.name'];
},
// Log span context under custom keys
// This is optional, and will default to "trace_id", "span_id" and "trace_flags" as the keys
logKeys: {
traceId: 'traceId',
spanId: 'spanId',
traceFlags: 'traceFlags',
},
}),

@@ -49,3 +57,3 @@ // other instrumentations

For the current active span, the following fields are injected:
For the current active span, the following fields are injected. These field names can be optionally configured via `logKeys` in the PinoInstrumentation config:

@@ -52,0 +60,0 @@ * `trace_id`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc