Socket
Socket
Sign inDemoInstall

@opentelemetry/plugin-pg

Package Overview
Dependencies
4
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.13.1 to 0.14.0

2

build/src/pg.d.ts
import { BasePlugin } from '@opentelemetry/core';
import * as pgTypes from 'pg';
import { PostgresPluginConfig } from './types';
export declare class PostgresPlugin extends BasePlugin<typeof pgTypes> {

@@ -7,2 +8,3 @@ readonly moduleName: string;

static readonly DB_TYPE = "sql";
protected _config: PostgresPluginConfig;
static readonly BASE_SPAN_NAME: string;

@@ -9,0 +11,0 @@ readonly supportedVersions: string[];

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

return (original) => {
plugin._logger.debug(`Patching ${PostgresPlugin.COMPONENT}.Client.prototype.query`);
api_1.diag.debug(`Patching ${PostgresPlugin.COMPONENT}.Client.prototype.query`);
return function query(...args) {

@@ -53,5 +53,11 @@ let span;

span = utils.handleParameterizedQuery.call(this, plugin._tracer, plugin._config, query, params);
if (plugin._config.postQueryHook) {
plugin._config.postQueryHook({ span, query, params });
}
}
else {
span = utils.handleTextQuery.call(this, plugin._tracer, query);
if (plugin._config.postQueryHook) {
plugin._config.postQueryHook({ span, query });
}
}

@@ -62,2 +68,5 @@ }

span = utils.handleConfigQuery.call(this, plugin._tracer, plugin._config, queryConfig);
if (plugin._config.postQueryHook) {
plugin._config.postQueryHook({ span, config: queryConfig });
}
}

@@ -105,3 +114,3 @@ else {

span.setStatus({
code: api_1.StatusCode.ERROR,
code: api_1.SpanStatusCode.ERROR,
message: error.message,

@@ -108,0 +117,0 @@ });

@@ -0,1 +1,3 @@

import { Span } from '@opentelemetry/api';
import { PluginConfig } from '@opentelemetry/core';
import * as pgTypes from 'pg';

@@ -15,2 +17,14 @@ export declare type PostgresCallback = (err: Error, res: object) => unknown;

}
export interface PostgresPostQueryHookFunction {
(ctx: QueryContext): void;
}
export interface QueryContext {
span: Span;
query?: string;
config?: NormalizedQueryConfig;
params?: unknown[];
}
export interface PostgresPluginConfig extends PluginConfig {
postQueryHook?: PostgresPostQueryHookFunction;
}
//# sourceMappingURL=types.d.ts.map

4

build/src/utils.js

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

catch (e) {
span.setStatus({ code: api_1.StatusCode.ERROR, message: e.message });
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e.message });
throw e;

@@ -125,3 +125,3 @@ }

span.setStatus({
code: api_1.StatusCode.ERROR,
code: api_1.SpanStatusCode.ERROR,
message: err.message,

@@ -128,0 +128,0 @@ });

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

export declare const VERSION = "0.13.1";
export declare const VERSION = "0.14.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.13.1';
exports.VERSION = '0.14.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/plugin-pg",
"version": "0.13.1",
"version": "0.14.0",
"description": "OpenTelemetry postgres automatic instrumentation package.",

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

"devDependencies": {
"@opentelemetry/context-async-hooks": "0.15.0",
"@opentelemetry/node": "0.15.0",
"@opentelemetry/test-utils": "^0.13.1",
"@opentelemetry/tracing": "0.15.0",
"@opentelemetry/context-async-hooks": "0.18.0",
"@opentelemetry/node": "0.18.0",
"@opentelemetry/test-utils": "^0.14.0",
"@opentelemetry/tracing": "0.18.0",
"@types/mocha": "7.0.2",

@@ -72,7 +72,7 @@ "@types/node": "14.0.27",

"dependencies": {
"@opentelemetry/api": "^0.15.0",
"@opentelemetry/core": "^0.15.0",
"@opentelemetry/api": "^0.18.0",
"@opentelemetry/core": "^0.18.0",
"shimmer": "^1.2.1"
},
"gitHead": "fa0700bae22c5e3d6f007b4353ed18f1f53a6c69"
"gitHead": "7a87f4105ff432380132d81f56a33e3f5c4e8fb1"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc