Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-grpc

Package Overview
Dependencies
Maintainers
2
Versions
186
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-grpc - npm Package Compare versions

Comparing version 0.31.0 to 0.32.0

build/src/enums/AttributeValues.d.ts

10

build/src/enums/AttributeNames.d.ts
/**
* https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md
*/
export declare enum AttributeNames {
GRPC_KIND = "grpc.kind",
GRPC_METHOD = "grpc.method",
GRPC_ERROR_NAME = "grpc.error_name",
GRPC_ERROR_MESSAGE = "grpc.error_message"
interface AttributesType {
GRPC_ERROR_NAME: string;
GRPC_ERROR_MESSAGE: string;
}
export declare const AttributeNames: Readonly<AttributesType>;
export {};
//# sourceMappingURL=AttributeNames.d.ts.map

@@ -19,12 +19,6 @@ "use strict";

exports.AttributeNames = void 0;
/**
* https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md
*/
var AttributeNames;
(function (AttributeNames) {
AttributeNames["GRPC_KIND"] = "grpc.kind";
AttributeNames["GRPC_METHOD"] = "grpc.method";
AttributeNames["GRPC_ERROR_NAME"] = "grpc.error_name";
AttributeNames["GRPC_ERROR_MESSAGE"] = "grpc.error_message";
})(AttributeNames = exports.AttributeNames || (exports.AttributeNames = {}));
exports.AttributeNames = {
GRPC_ERROR_NAME: 'grpc.error_name',
GRPC_ERROR_MESSAGE: 'grpc.error_message',
};
//# sourceMappingURL=AttributeNames.js.map

@@ -87,6 +87,2 @@ "use strict";

}
span.setAttributes({
[AttributeNames_1.AttributeNames.GRPC_METHOD]: original.path,
[AttributeNames_1.AttributeNames.GRPC_KIND]: api_1.SpanKind.CLIENT,
});
setSpanContext(metadata);

@@ -93,0 +89,0 @@ const call = original.apply(self, args);

@@ -24,3 +24,5 @@ "use strict";

const clientUtils_1 = require("./clientUtils");
const AttributeNames_1 = require("../enums/AttributeNames");
const utils_1 = require("../utils");
const AttributeValues_1 = require("../enums/AttributeValues");
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
class GrpcJsInstrumentation extends instrumentation_2.InstrumentationBase {

@@ -94,6 +96,9 @@ constructor(name, version, config) {

}), () => {
const { service, method } = (0, utils_1._extractMethodAndService)(name);
const span = instrumentation.tracer
.startSpan(spanName, spanOptions)
.setAttributes({
[AttributeNames_1.AttributeNames.GRPC_KIND]: spanOptions.kind,
[semantic_conventions_1.SemanticAttributes.RPC_SYSTEM]: AttributeValues_1.AttributeValues.RPC_SYSTEM,
[semantic_conventions_1.SemanticAttributes.RPC_METHOD]: method,
[semantic_conventions_1.SemanticAttributes.RPC_SERVICE]: service,
});

@@ -151,4 +156,9 @@ api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), () => {

const metadata = clientUtils_1.getMetadata.call(instrumentation, grpcClient, original, args);
const span = instrumentation.tracer.startSpan(name, {
kind: api_1.SpanKind.CLIENT,
const { service, method } = (0, utils_1._extractMethodAndService)(original.path);
const span = instrumentation.tracer
.startSpan(name, { kind: api_1.SpanKind.CLIENT })
.setAttributes({
[semantic_conventions_1.SemanticAttributes.RPC_SYSTEM]: 'grpc',
[semantic_conventions_1.SemanticAttributes.RPC_METHOD]: method,
[semantic_conventions_1.SemanticAttributes.RPC_SERVICE]: service,
});

@@ -155,0 +165,0 @@ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), () => (0, clientUtils_1.makeGrpcClientRemoteCall)(original, args, metadata, this)(span));

@@ -66,6 +66,2 @@ "use strict";

span.addEvent('sent');
span.setAttributes({
[AttributeNames_1.AttributeNames.GRPC_METHOD]: original.path,
[AttributeNames_1.AttributeNames.GRPC_KIND]: api_1.SpanKind.CLIENT,
});
setSpanContext(metadata);

@@ -72,0 +68,0 @@ const call = original.apply(self, args);

@@ -24,3 +24,4 @@ "use strict";

const utils_1 = require("../utils");
const AttributeNames_1 = require("../enums/AttributeNames");
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
const AttributeValues_1 = require("../enums/AttributeValues");
/**

@@ -112,6 +113,9 @@ * Holding reference to grpc module here to access constant of grpc modules

}), () => {
const { service, method } = (0, utils_1._extractMethodAndService)(name);
const span = instrumentation.tracer
.startSpan(spanName, spanOptions)
.setAttributes({
[AttributeNames_1.AttributeNames.GRPC_KIND]: spanOptions.kind,
[semantic_conventions_1.SemanticAttributes.RPC_SYSTEM]: AttributeValues_1.AttributeValues.RPC_SYSTEM,
[semantic_conventions_1.SemanticAttributes.RPC_METHOD]: method,
[semantic_conventions_1.SemanticAttributes.RPC_SERVICE]: service,
});

@@ -175,4 +179,10 @@ api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), () => {

const metadata = (0, clientUtils_1.getMetadata)(grpcClient, original, args);
const { service, method } = (0, utils_1._extractMethodAndService)(original.path);
const span = instrumentation.tracer.startSpan(name, {
kind: api_1.SpanKind.CLIENT,
})
.setAttributes({
[semantic_conventions_1.SemanticAttributes.RPC_SYSTEM]: AttributeValues_1.AttributeValues.RPC_SYSTEM,
[semantic_conventions_1.SemanticAttributes.RPC_METHOD]: method,
[semantic_conventions_1.SemanticAttributes.RPC_SERVICE]: service,
});

@@ -179,0 +189,0 @@ return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), () => (0, clientUtils_1.makeGrpcClientRemoteCall)(grpcClient, original, args, metadata, this)(span));

@@ -20,2 +20,10 @@ import { SpanStatusCode, SpanStatus } from '@opentelemetry/api';

export declare const _methodIsIgnored: (methodName: string, ignoredMethods?: IgnoreMatcher[] | undefined) => boolean;
/**
* Return method and service values getting from grpc name/path
* @param name the grpc name/path
*/
export declare const _extractMethodAndService: (name: string) => {
service: string;
method: string;
};
//# sourceMappingURL=utils.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports._methodIsIgnored = exports._grpcStatusCodeToSpanStatus = exports._grpcStatusCodeToOpenTelemetryStatusCode = exports.findIndex = void 0;
exports._extractMethodAndService = exports._methodIsIgnored = exports._grpcStatusCodeToSpanStatus = exports._grpcStatusCodeToOpenTelemetryStatusCode = exports.findIndex = void 0;
const api_1 = require("@opentelemetry/api");

@@ -87,2 +87,16 @@ // Equivalent to lodash _.findIndex

exports._methodIsIgnored = _methodIsIgnored;
/**
* Return method and service values getting from grpc name/path
* @param name the grpc name/path
*/
const _extractMethodAndService = (name) => {
const serviceMethod = name.replace(/^\//, '').split('/');
const service = serviceMethod.shift() || '';
const method = serviceMethod.join('/');
return ({
service,
method
});
};
exports._extractMethodAndService = _extractMethodAndService;
//# sourceMappingURL=utils.js.map

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

export declare const VERSION = "0.31.0";
export declare const VERSION = "0.32.0";
//# sourceMappingURL=version.d.ts.map

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

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

@@ -51,13 +51,13 @@ "main": "build/src/index.js",

"@opentelemetry/api": "^1.0.0",
"@opentelemetry/context-async-hooks": "1.5.0",
"@opentelemetry/core": "1.5.0",
"@opentelemetry/sdk-trace-base": "1.5.0",
"@opentelemetry/sdk-trace-node": "1.5.0",
"@types/mocha": "8.2.3",
"@types/node": "14.17.33",
"@opentelemetry/context-async-hooks": "1.6.0",
"@opentelemetry/core": "1.6.0",
"@opentelemetry/sdk-trace-base": "1.6.0",
"@opentelemetry/sdk-trace-node": "1.6.0",
"@types/mocha": "9.1.1",
"@types/node": "18.6.5",
"@types/semver": "7.3.9",
"@types/sinon": "10.0.6",
"@types/sinon": "10.0.13",
"codecov": "3.8.3",
"grpc": "1.24.11",
"mocha": "7.2.0",
"mocha": "10.0.0",
"node-pre-gyp": "0.17.0",

@@ -67,4 +67,4 @@ "nyc": "15.1.0",

"semver": "7.3.5",
"sinon": "12.0.1",
"ts-mocha": "9.0.2",
"sinon": "14.0.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"

@@ -76,8 +76,8 @@ },

"dependencies": {
"@opentelemetry/api-metrics": "0.31.0",
"@opentelemetry/instrumentation": "0.31.0",
"@opentelemetry/semantic-conventions": "1.5.0"
"@opentelemetry/api-metrics": "0.32.0",
"@opentelemetry/instrumentation": "0.32.0",
"@opentelemetry/semantic-conventions": "1.6.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc",
"gitHead": "776656b6e0cd0fc49a52b734702bc77110e483f1"
"gitHead": "a5abee69119cc41d9d34f6beb5c1826eef1ac0dd"
}

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

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

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