@opentelemetry/instrumentation-grpc
Advanced tools
Comparing version 0.26.0 to 0.27.0
@@ -32,3 +32,3 @@ "use strict"; | ||
Object.entries(methods).forEach(([name, { originalName }]) => { | ||
if (!utils_1._methodIsIgnored(name, this._config.ignoreGrpcMethods)) { | ||
if (!utils_1._methodIsIgnored(name, this.getConfig().ignoreGrpcMethods)) { | ||
methodList.push(name); // adds camel case method name: "unaryMethod" | ||
@@ -35,0 +35,0 @@ if (originalName && |
import type * as grpcJs from '@grpc/grpc-js'; | ||
import { InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; | ||
import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
import { InstrumentationBase } from '@opentelemetry/instrumentation'; | ||
import { GrpcInstrumentationConfig } from '../types'; | ||
export declare class GrpcJsInstrumentation extends InstrumentationBase { | ||
protected _config: GrpcInstrumentationConfig & InstrumentationConfig; | ||
constructor(_config: GrpcInstrumentationConfig & InstrumentationConfig, name: string, version: string); | ||
setConfig(config?: GrpcInstrumentationConfig & InstrumentationConfig): void; | ||
constructor(name: string, version: string, config?: GrpcInstrumentationConfig); | ||
init(): InstrumentationNodeModuleDefinition<typeof grpcJs>[]; | ||
getConfig(): GrpcInstrumentationConfig; | ||
/** | ||
@@ -11,0 +10,0 @@ * Patch for grpc.Server.prototype.register(...) function. Provides auto-instrumentation for |
@@ -26,9 +26,5 @@ "use strict"; | ||
class GrpcJsInstrumentation extends instrumentation_2.InstrumentationBase { | ||
constructor(_config = {}, name, version) { | ||
super(name, version, _config); | ||
this._config = _config; | ||
constructor(name, version, config) { | ||
super(name, version, config); | ||
} | ||
setConfig(config = {}) { | ||
this._config = Object.assign({}, config); | ||
} | ||
init() { | ||
@@ -68,2 +64,5 @@ return [ | ||
} | ||
getConfig() { | ||
return super.getConfig(); | ||
} | ||
/** | ||
@@ -76,3 +75,3 @@ * Patch for grpc.Server.prototype.register(...) function. Provides auto-instrumentation for | ||
return (originalRegister) => { | ||
const config = this._config; | ||
const config = this.getConfig(); | ||
instrumentation._diag.debug('patched gRPC server'); | ||
@@ -79,0 +78,0 @@ return function register(name, handler, serialize, deserialize, type) { |
import type * as grpcTypes from 'grpc'; | ||
import { InstrumentationNodeModuleDefinition, InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
import { InstrumentationNodeModuleDefinition, InstrumentationBase } from '@opentelemetry/instrumentation'; | ||
import { GrpcInstrumentationConfig } from '../types'; | ||
export declare class GrpcNativeInstrumentation extends InstrumentationBase<typeof grpcTypes> { | ||
protected _config: GrpcInstrumentationConfig & InstrumentationConfig; | ||
constructor(_config: GrpcInstrumentationConfig & InstrumentationConfig, name: string, version: string); | ||
setConfig(config?: GrpcInstrumentationConfig & InstrumentationConfig): void; | ||
constructor(name: string, version: string, config?: GrpcInstrumentationConfig); | ||
init(): InstrumentationNodeModuleDefinition<typeof grpcTypes>[]; | ||
getConfig(): GrpcInstrumentationConfig; | ||
private _getInternalPatchs; | ||
@@ -10,0 +9,0 @@ private _patchServer; |
@@ -31,9 +31,5 @@ "use strict"; | ||
class GrpcNativeInstrumentation extends instrumentation_1.InstrumentationBase { | ||
constructor(_config = {}, name, version) { | ||
super(name, version, _config); | ||
this._config = _config; | ||
constructor(name, version, config) { | ||
super(name, version, config); | ||
} | ||
setConfig(config = {}) { | ||
this._config = Object.assign({}, config); | ||
} | ||
init() { | ||
@@ -62,2 +58,5 @@ return [ | ||
} | ||
getConfig() { | ||
return super.getConfig(); | ||
} | ||
_getInternalPatchs() { | ||
@@ -153,3 +152,3 @@ const onPatch = (moduleExports, version) => { | ||
Object.entries(methods).forEach(([name, { originalName }]) => { | ||
if (!utils_1._methodIsIgnored(name, this._config.ignoreGrpcMethods)) { | ||
if (!utils_1._methodIsIgnored(name, this.getConfig().ignoreGrpcMethods)) { | ||
methodList.push(name); // adds camel case method name: "unaryMethod" | ||
@@ -156,0 +155,0 @@ if (originalName && |
@@ -89,5 +89,5 @@ "use strict"; | ||
const parsedName = name.split('/'); | ||
return utils_1._methodIsIgnored(parsedName[parsedName.length - 1] || name, this._config.ignoreGrpcMethods); | ||
return utils_1._methodIsIgnored(parsedName[parsedName.length - 1] || name, this.getConfig().ignoreGrpcMethods); | ||
}; | ||
exports.shouldNotTraceServerCall = shouldNotTraceServerCall; | ||
//# sourceMappingURL=serverUtils.js.map |
@@ -1,2 +0,1 @@ | ||
import { InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
import { GrpcInstrumentationConfig } from './types'; | ||
@@ -8,3 +7,2 @@ import * as api from '@opentelemetry/api'; | ||
export declare class GrpcInstrumentation { | ||
protected _config: GrpcInstrumentationConfig & InstrumentationConfig; | ||
private _grpcNativeInstrumentation; | ||
@@ -14,4 +12,4 @@ private _grpcJsInstrumentation; | ||
readonly instrumentationVersion: string; | ||
constructor(_config?: GrpcInstrumentationConfig & InstrumentationConfig); | ||
setConfig(config?: GrpcInstrumentationConfig & InstrumentationConfig): void; | ||
constructor(config?: GrpcInstrumentationConfig); | ||
setConfig(config?: GrpcInstrumentationConfig): void; | ||
/** | ||
@@ -22,3 +20,3 @@ * @internal | ||
*/ | ||
getConfig(): GrpcInstrumentationConfig & InstrumentationConfig; | ||
getConfig(): GrpcInstrumentationConfig; | ||
init(): void; | ||
@@ -25,0 +23,0 @@ enable(): void; |
@@ -25,13 +25,11 @@ "use strict"; | ||
class GrpcInstrumentation { | ||
constructor(_config = {}) { | ||
this._config = _config; | ||
constructor(config) { | ||
this.instrumentationName = '@opentelemetry/instrumentation-grpc'; | ||
this.instrumentationVersion = version_1.VERSION; | ||
this._grpcJsInstrumentation = new grpc_js_1.GrpcJsInstrumentation(_config, this.instrumentationName, this.instrumentationVersion); | ||
this._grpcNativeInstrumentation = new grpc_1.GrpcNativeInstrumentation(_config, this.instrumentationName, this.instrumentationVersion); | ||
this._grpcJsInstrumentation = new grpc_js_1.GrpcJsInstrumentation(this.instrumentationName, this.instrumentationVersion, config); | ||
this._grpcNativeInstrumentation = new grpc_1.GrpcNativeInstrumentation(this.instrumentationName, this.instrumentationVersion, config); | ||
} | ||
setConfig(config = {}) { | ||
this._config = Object.assign({}, config); | ||
this._grpcJsInstrumentation.setConfig(this._config); | ||
this._grpcNativeInstrumentation.setConfig(this._config); | ||
setConfig(config) { | ||
this._grpcJsInstrumentation.setConfig(config); | ||
this._grpcNativeInstrumentation.setConfig(config); | ||
} | ||
@@ -44,3 +42,4 @@ /** | ||
getConfig() { | ||
return this._config; | ||
// grpcNative and grpcJs have their own config copy which should be identical so just pick one | ||
return this._grpcJsInstrumentation.getConfig(); | ||
} | ||
@@ -47,0 +46,0 @@ init() { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.26.0"; | ||
export declare const VERSION = "0.27.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.26.0'; | ||
exports.VERSION = '0.27.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-grpc", | ||
"version": "0.26.0", | ||
"version": "0.27.0", | ||
"description": "OpenTelemetry grpc automatic instrumentation package.", | ||
@@ -48,7 +48,7 @@ "main": "build/src/index.js", | ||
"@grpc/proto-loader": "0.6.4", | ||
"@opentelemetry/api": "^1.0.2", | ||
"@opentelemetry/context-async-hooks": "1.0.0", | ||
"@opentelemetry/core": "1.0.0", | ||
"@opentelemetry/sdk-trace-base": "1.0.0", | ||
"@opentelemetry/sdk-trace-node": "1.0.0", | ||
"@opentelemetry/api": "^1.0.3", | ||
"@opentelemetry/context-async-hooks": "1.0.1", | ||
"@opentelemetry/core": "1.0.1", | ||
"@opentelemetry/sdk-trace-base": "1.0.1", | ||
"@opentelemetry/sdk-trace-node": "1.0.1", | ||
"@types/mocha": "8.2.3", | ||
@@ -65,3 +65,3 @@ "@types/node": "14.17.11", | ||
"semver": "7.3.5", | ||
"sinon": "11.1.2", | ||
"sinon": "12.0.1", | ||
"ts-mocha": "8.0.0", | ||
@@ -71,10 +71,10 @@ "typescript": "4.3.5" | ||
"peerDependencies": { | ||
"@opentelemetry/api": "^1.0.2" | ||
"@opentelemetry/api": "^1.0.0" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api-metrics": "0.26.0", | ||
"@opentelemetry/instrumentation": "0.26.0", | ||
"@opentelemetry/semantic-conventions": "1.0.0" | ||
"@opentelemetry/api-metrics": "0.27.0", | ||
"@opentelemetry/instrumentation": "0.27.0", | ||
"@opentelemetry/semantic-conventions": "1.0.1" | ||
}, | ||
"gitHead": "0f5a5bc906a2166c30a4344e460b7206c0b20bac" | ||
"gitHead": "f5e227f0cb829df1ca2dc220a3e0e8ae0e607405" | ||
} |
@@ -49,3 +49,3 @@ # OpenTelemetry gRPC Instrumentation for Node.js | ||
| ------- | ---- | ----------- | | ||
| [`ignoreGrpcMethods`](https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation-grpc/src/types.ts#L32) | `IgnoreMatcher[]` | gRPC instrumentation will not trace any methods that match anything in this list. You may pass a string (case-insensitive match), a `RegExp` object, or a filter function. | | ||
| [`ignoreGrpcMethods`](https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-grpc/src/types.ts#L25) | `IgnoreMatcher[]` | gRPC instrumentation will not trace any methods that match anything in this list. You may pass a string (case-insensitive match), a `RegExp` object, or a filter function. | | ||
@@ -52,0 +52,0 @@ ## Useful links |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170672
1451
+ Added@opentelemetry/api-metrics@0.27.0(transitive)
+ Added@opentelemetry/instrumentation@0.27.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.0.1(transitive)
- Removed@opentelemetry/api-metrics@0.26.0(transitive)
- Removed@opentelemetry/instrumentation@0.26.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.0.0(transitive)