@opentelemetry/plugin-grpc
Advanced tools
Comparing version 0.8.3 to 0.9.0
@@ -1,16 +0,1 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { BasePlugin } from '@opentelemetry/core'; | ||
@@ -17,0 +2,0 @@ import * as grpcTypes from 'grpc'; |
"use strict"; | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
@@ -18,7 +18,8 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.plugin = exports.GrpcPlugin = exports.GRPC_TRACE_KEY = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
const core_1 = require("@opentelemetry/core"); | ||
const path = require("path"); | ||
const shimmer = require("shimmer"); | ||
const AttributeNames_1 = require("./enums/AttributeNames"); | ||
const utils_1 = require("./utils"); | ||
@@ -88,4 +89,4 @@ const version_1 = require("./version"); | ||
.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_KIND]: spanOptions.kind, | ||
[AttributeNames_1.AttributeNames.COMPONENT]: GrpcPlugin.component, | ||
[semantic_conventions_1.RpcAttribute.GRPC_KIND]: spanOptions.kind, | ||
[semantic_conventions_1.GeneralAttribute.COMPONENT]: GrpcPlugin.component, | ||
}); | ||
@@ -119,7 +120,7 @@ plugin._tracer.withSpan(span, () => { | ||
}); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, err.code.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, err.code.toString()); | ||
} | ||
span.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_NAME]: err.name, | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_MESSAGE]: err.message, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_NAME]: err.name, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_MESSAGE]: err.message, | ||
}); | ||
@@ -129,3 +130,3 @@ } | ||
span.setStatus({ code: api_1.CanonicalCode.OK }); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString()); | ||
} | ||
@@ -151,3 +152,3 @@ span.addEvent('received'); | ||
span.setStatus(utils_1._grpcStatusCodeToSpanStatus(call.status.code)); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, call.status.code.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, call.status.code.toString()); | ||
// if there is an error, span will be ended on error event, otherwise end it here | ||
@@ -166,4 +167,4 @@ if (call.status.code === 0) { | ||
span.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_NAME]: err.name, | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_MESSAGE]: err.message, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_NAME]: err.name, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_MESSAGE]: err.message, | ||
}); | ||
@@ -207,3 +208,3 @@ endSpan(); | ||
}) | ||
.setAttribute(AttributeNames_1.AttributeNames.COMPONENT, GrpcPlugin.component); | ||
.setAttribute(semantic_conventions_1.GeneralAttribute.COMPONENT, GrpcPlugin.component); | ||
return plugin._tracer.withSpan(span, () => plugin._makeGrpcClientRemoteCall(original, args, this, plugin)(span)); | ||
@@ -226,7 +227,7 @@ }; | ||
span.setStatus(utils_1._grpcStatusCodeToSpanStatus(err.code)); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, err.code.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, err.code.toString()); | ||
} | ||
span.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_NAME]: err.name, | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_MESSAGE]: err.message, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_NAME]: err.name, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_MESSAGE]: err.message, | ||
}); | ||
@@ -236,3 +237,3 @@ } | ||
span.setStatus({ code: api_1.CanonicalCode.OK }); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, plugin._moduleExports.status.OK.toString()); | ||
} | ||
@@ -260,4 +261,4 @@ span.end(); | ||
span.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_METHOD]: original.path, | ||
[AttributeNames_1.AttributeNames.GRPC_KIND]: api_1.SpanKind.CLIENT, | ||
[semantic_conventions_1.RpcAttribute.GRPC_METHOD]: original.path, | ||
[semantic_conventions_1.RpcAttribute.GRPC_KIND]: api_1.SpanKind.CLIENT, | ||
}); | ||
@@ -284,4 +285,4 @@ this._setSpanContext(metadata); | ||
span.setAttributes({ | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_NAME]: err.name, | ||
[AttributeNames_1.AttributeNames.GRPC_ERROR_MESSAGE]: err.message, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_NAME]: err.name, | ||
[semantic_conventions_1.RpcAttribute.GRPC_ERROR_MESSAGE]: err.message, | ||
}); | ||
@@ -292,3 +293,3 @@ endSpan(); | ||
span.setStatus({ code: api_1.CanonicalCode.OK }); | ||
span.setAttribute(AttributeNames_1.AttributeNames.GRPC_STATUS_CODE, status.code.toString()); | ||
span.setAttribute(semantic_conventions_1.RpcAttribute.GRPC_STATUS_CODE, status.code.toString()); | ||
endSpan(); | ||
@@ -295,0 +296,0 @@ }); |
@@ -1,17 +0,2 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export * from './grpc'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
@@ -17,7 +17,14 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
*/ | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./grpc")); | ||
__exportStar(require("./grpc"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,16 +0,1 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/// <reference types="node" /> | ||
@@ -17,0 +2,0 @@ import * as grpcModule from 'grpc'; |
"use strict"; | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -1,16 +0,1 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { CanonicalCode, Status } from '@opentelemetry/api'; | ||
@@ -17,0 +2,0 @@ import * as grpcTypes from 'grpc'; |
"use strict"; | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
@@ -18,2 +18,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._grpcStatusCodeToSpanStatus = exports._grpcStatusCodeToCanonicalCode = exports.findIndex = void 0; | ||
const api_1 = require("@opentelemetry/api"); | ||
@@ -20,0 +21,0 @@ // Equivalent to lodash _.findIndex |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.8.3"; | ||
export declare const VERSION = "0.9.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
/* | ||
* Copyright 2020, OpenTelemetry Authors | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
@@ -18,4 +18,5 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.8.3'; | ||
exports.VERSION = '0.9.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/plugin-grpc", | ||
"version": "0.8.3", | ||
"version": "0.9.0", | ||
"description": "OpenTelemetry grpc automatic instrumentation package.", | ||
@@ -44,29 +44,30 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@opentelemetry/context-async-hooks": "^0.8.3", | ||
"@opentelemetry/context-base": "^0.8.3", | ||
"@opentelemetry/node": "^0.8.3", | ||
"@opentelemetry/tracing": "^0.8.3", | ||
"@types/mocha": "^7.0.0", | ||
"@types/node": "^14.0.5", | ||
"@types/semver": "^7.1.0", | ||
"@types/shimmer": "^1.0.1", | ||
"@types/sinon": "^7.0.13", | ||
"codecov": "^3.6.1", | ||
"grpc": "^1.23.3", | ||
"gts": "^2.0.0", | ||
"mocha": "^7.1.2", | ||
"node-pre-gyp": "^0.12.0", | ||
"nyc": "^15.0.0", | ||
"rimraf": "^3.0.0", | ||
"@opentelemetry/context-async-hooks": "^0.9.0", | ||
"@opentelemetry/context-base": "^0.9.0", | ||
"@opentelemetry/node": "^0.9.0", | ||
"@opentelemetry/tracing": "^0.9.0", | ||
"@types/mocha": "7.0.2", | ||
"@types/node": "14.0.13", | ||
"@types/semver": "7.2.0", | ||
"@types/shimmer": "1.0.1", | ||
"@types/sinon": "9.0.4", | ||
"codecov": "3.7.0", | ||
"grpc": "1.24.3", | ||
"gts": "2.0.2", | ||
"mocha": "7.2.0", | ||
"node-pre-gyp": "0.15.0", | ||
"nyc": "15.1.0", | ||
"rimraf": "3.0.2", | ||
"semver": "7.3.2", | ||
"sinon": "^7.5.0", | ||
"ts-mocha": "^7.0.0", | ||
"ts-node": "^8.6.2", | ||
"typescript": "3.7.2" | ||
"sinon": "9.0.2", | ||
"ts-mocha": "7.0.0", | ||
"ts-node": "8.10.2", | ||
"typescript": "3.9.5" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.8.3", | ||
"@opentelemetry/core": "^0.8.3", | ||
"@opentelemetry/api": "^0.9.0", | ||
"@opentelemetry/core": "^0.9.0", | ||
"@opentelemetry/semantic-conventions": "^0.9.0", | ||
"shimmer": "^1.2.1" | ||
} | ||
} |
# OpenTelemetry gRPC Instrumentation for Node.js | ||
[![Gitter chat][gitter-image]][gitter-url] | ||
@@ -15,3 +16,3 @@ [![NPM Published Version][npm-img]][npm-url] | ||
``` | ||
```sh | ||
npm install --save @opentelemetry/plugin-grpc | ||
@@ -25,2 +26,3 @@ ``` | ||
To load a specific plugin (**gRPC** in this case), specify it in the Node Tracer's configuration. | ||
```javascript | ||
@@ -41,2 +43,3 @@ const { NodeTracerProvider } = require('@opentelemetry/node'); | ||
To load all of the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules. | ||
```javascript | ||
@@ -50,4 +53,4 @@ const { NodeTracerProvider } = require('@opentelemetry/node'); | ||
## Useful links | ||
## Useful links | ||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/> | ||
@@ -54,0 +57,0 @@ - For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js> |
70
41287
4
570
+ Added@opentelemetry/api@0.9.0(transitive)
+ Added@opentelemetry/context-base@0.9.0(transitive)
+ Added@opentelemetry/core@0.9.0(transitive)
+ Added@opentelemetry/semantic-conventions@0.9.0(transitive)
- Removed@opentelemetry/api@0.8.3(transitive)
- Removed@opentelemetry/context-base@0.8.3(transitive)
- Removed@opentelemetry/core@0.8.3(transitive)
Updated@opentelemetry/api@^0.9.0
Updated@opentelemetry/core@^0.9.0