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

@opentelemetry/plugin-grpc

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/plugin-grpc - npm Package Compare versions

Comparing version 0.12.1-alpha.54 to 0.13.0

25

build/src/grpc.js

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

_setSpanContext(metadata) {
api_1.propagation.inject(metadata, (metadata, k, v) => metadata.set(k, v));
api_1.propagation.inject(metadata, {
set: (metadata, k, v) => metadata.set(k, v),
});
}

@@ -97,3 +99,6 @@ _patchServer() {

plugin._logger.debug('patch func: %s', JSON.stringify(spanOptions));
api_1.context.with(api_1.propagation.extract(call.metadata, (carrier, key) => carrier.get(key)), () => {
api_1.context.with(api_1.propagation.extract(call.metadata, {
get: (metadata, key) => metadata.get(key).map(String),
keys: metadata => Object.keys(metadata.getMap()),
}), () => {
const span = plugin._tracer

@@ -135,3 +140,3 @@ .startSpan(spanName, spanOptions)

span.setStatus({
code: utils_1._grpcStatusCodeToCanonicalCode(err.code),
code: utils_1._grpcStatusCodeToOpenTelemetryStatusCode(err.code),
message: err.message,

@@ -147,3 +152,3 @@ });

else {
span.setStatus({ code: api_1.CanonicalCode.OK });
span.setStatus({ code: api_1.StatusCode.OK });
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString());

@@ -179,3 +184,3 @@ }

span.setStatus({
code: utils_1._grpcStatusCodeToCanonicalCode(err.code),
code: utils_1._grpcStatusCodeToOpenTelemetryStatusCode(err.code),
message: err.message,

@@ -196,3 +201,3 @@ });

plugin._logger.debug('patching client');
return function makeClientConstructor(methods, serviceName, options) {
return function makeClientConstructor(methods, _serviceName, _options) {
const client = original.apply(this, arguments);

@@ -245,3 +250,3 @@ shimmer.massWrap(client.prototype, plugin._getMethodsToWrap(client, methods), plugin._getPatchedClientMethods());

*/
function patchedCallback(span, callback, metadata) {
function patchedCallback(span, callback, _metadata) {
const wrappedFn = (err, res) => {

@@ -259,3 +264,3 @@ if (err) {

else {
span.setStatus({ code: api_1.CanonicalCode.OK });
span.setStatus({ code: api_1.StatusCode.OK });
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString());

@@ -302,3 +307,3 @@ }

span.setStatus({
code: utils_1._grpcStatusCodeToCanonicalCode(err.code),
code: utils_1._grpcStatusCodeToOpenTelemetryStatusCode(err.code),
message: err.message,

@@ -313,3 +318,3 @@ });

call.on('status', (status) => {
span.setStatus({ code: api_1.CanonicalCode.OK });
span.setStatus({ code: api_1.StatusCode.OK });
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, status.code.toString());

@@ -316,0 +321,0 @@ endSpan();

6

build/src/utils.d.ts

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

import { CanonicalCode, Status } from '@opentelemetry/api';
import { StatusCode, Status } from '@opentelemetry/api';
import * as grpcTypes from 'grpc';

@@ -6,6 +6,6 @@ import { IgnoreMatcher } from './types';

/**
* Convert a grpc status code to an opentelemetry Canonical code. For now, the enums are exactly the same
* Convert a grpc status code to an opentelemetry Status code.
* @param status
*/
export declare const _grpcStatusCodeToCanonicalCode: (status?: grpcTypes.status | undefined) => CanonicalCode;
export declare const _grpcStatusCodeToOpenTelemetryStatusCode: (status?: grpcTypes.status | undefined) => StatusCode;
export declare const _grpcStatusCodeToSpanStatus: (status: number) => Status;

@@ -12,0 +12,0 @@ /**

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

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

@@ -33,13 +33,13 @@ // Equivalent to lodash _.findIndex

/**
* Convert a grpc status code to an opentelemetry Canonical code. For now, the enums are exactly the same
* Convert a grpc status code to an opentelemetry Status code.
* @param status
*/
exports._grpcStatusCodeToCanonicalCode = (status) => {
if (status !== 0 && !status) {
return api_1.CanonicalCode.UNKNOWN;
exports._grpcStatusCodeToOpenTelemetryStatusCode = (status) => {
if (status !== undefined && status === 0) {
return api_1.StatusCode.OK;
}
return status;
return api_1.StatusCode.ERROR;
};
exports._grpcStatusCodeToSpanStatus = (status) => {
return { code: status };
return { code: exports._grpcStatusCodeToOpenTelemetryStatusCode(status) };
};

@@ -46,0 +46,0 @@ /**

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

export declare const VERSION = "0.12.1-alpha.54+3f72613a";
export declare const VERSION = "0.13.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.12.1-alpha.54+3f72613a';
exports.VERSION = '0.13.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/plugin-grpc",
"version": "0.12.1-alpha.54+3f72613a",
"version": "0.13.0",
"description": "OpenTelemetry grpc automatic instrumentation package.",

@@ -45,22 +45,22 @@ "main": "build/src/index.js",

"devDependencies": {
"@opentelemetry/context-async-hooks": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/context-base": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/grpc-utils": "^0.12.0",
"@opentelemetry/node": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/tracing": "^0.12.1-alpha.54+3f72613a",
"@types/mocha": "8.0.2",
"@types/node": "14.0.27",
"@types/semver": "7.3.2",
"@opentelemetry/context-async-hooks": "^0.13.0",
"@opentelemetry/context-base": "^0.13.0",
"@opentelemetry/grpc-utils": "^0.13.0",
"@opentelemetry/node": "^0.13.0",
"@opentelemetry/tracing": "^0.13.0",
"@types/mocha": "8.0.4",
"@types/node": "14.14.10",
"@types/semver": "7.3.4",
"@types/shimmer": "1.0.1",
"@types/sinon": "9.0.4",
"codecov": "3.7.2",
"grpc": "1.24.3",
"@types/sinon": "9.0.9",
"codecov": "3.8.1",
"grpc": "1.24.4",
"gts": "2.0.2",
"mocha": "7.2.0",
"node-pre-gyp": "0.15.0",
"node-pre-gyp": "0.16.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"semver": "7.3.2",
"sinon": "9.0.3",
"ts-mocha": "7.0.0",
"sinon": "9.2.1",
"ts-mocha": "8.0.0",
"ts-node": "9.0.0",

@@ -70,8 +70,8 @@ "typescript": "3.9.7"

"dependencies": {
"@opentelemetry/api": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/core": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/semantic-conventions": "^0.12.1-alpha.54+3f72613a",
"@opentelemetry/api": "^0.13.0",
"@opentelemetry/core": "^0.13.0",
"@opentelemetry/semantic-conventions": "^0.13.0",
"shimmer": "^1.2.1"
},
"gitHead": "3f72613a36b6f97555a0fa7481755cf8b6cce1a7"
"gitHead": "86cbd6798f9318c5920f9d9055f289a1c3f26500"
}

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