Skip to content

Commit 0eb0283

Browse files
committed
Remove unnecessary interceptor argument
1 parent 2266bd0 commit 0eb0283

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

packages/opentelemetry-instrumentation-connect-node/src/instrumentation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ConnectNodeInstrumentation extends InstrumentationBase<ConnectNodeI
5050
this._diag.debug('patched createConnectTransport');
5151

5252
return (options: ConnectTransportOptions) => {
53-
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer, 'client');
53+
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer);
5454

5555
return original({
5656
...options,
@@ -65,7 +65,7 @@ export class ConnectNodeInstrumentation extends InstrumentationBase<ConnectNodeI
6565
this._diag.debug('patched createGrpcTransport');
6666

6767
return (options: GrpcTransportOptions) => {
68-
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer, 'client');
68+
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer);
6969

7070
return original({
7171
...options,
@@ -80,7 +80,7 @@ export class ConnectNodeInstrumentation extends InstrumentationBase<ConnectNodeI
8080
this._diag.debug('patched createGrpcWebTransport');
8181

8282
return (options: GrpcWebTransportOptions) => {
83-
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer, 'client');
83+
const interceptor = createClientInterceptor(this.getConfig(), this._diag, this.tracer);
8484

8585
return original({
8686
...options,
@@ -95,7 +95,7 @@ export class ConnectNodeInstrumentation extends InstrumentationBase<ConnectNodeI
9595
this._diag.debug('patched connectNodeAdapter');
9696

9797
return (options: ConnectNodeAdapterOptions) => {
98-
const interceptor = createServerInterceptor(this.getConfig(), this._diag, this.tracer, 'server');
98+
const interceptor = createServerInterceptor(this.getConfig(), this._diag, this.tracer);
9999

100100
return original({
101101
...options,

packages/opentelemetry-instrumentation-connect-node/src/interceptor.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,10 @@ const carrierSetterAndGetter = {
135135
set: (carrier: Headers, key: string, value: string) => carrier.set(key, value)
136136
};
137137

138-
export const createClientInterceptor = (
139-
config: ConnectNodeInstrumentationConfig,
140-
diag: DiagLogger,
141-
tracer: Tracer,
142-
kind: RpcKind
143-
) => {
144-
const startSpan = createStartSpan(config, tracer, kind);
145-
const endSpanWithSuccess = createEndSpanWithSuccess(config, kind);
146-
const endSpanWithError = createEndSpanWithError(config, kind);
138+
export const createClientInterceptor = (config: ConnectNodeInstrumentationConfig, diag: DiagLogger, tracer: Tracer) => {
139+
const startSpan = createStartSpan(config, tracer, 'client');
140+
const endSpanWithSuccess = createEndSpanWithSuccess(config, 'client');
141+
const endSpanWithError = createEndSpanWithError(config, 'client');
147142

148143
return (next: InterceptorAnyFn): InterceptorAnyFn =>
149144
async req => {
@@ -187,15 +182,10 @@ export const createClientInterceptor = (
187182
};
188183
};
189184

190-
export const createServerInterceptor = (
191-
config: ConnectNodeInstrumentationConfig,
192-
diag: DiagLogger,
193-
tracer: Tracer,
194-
kind: RpcKind
195-
) => {
196-
const startSpan = createStartSpan(config, tracer, kind);
197-
const endSpanWithSuccess = createEndSpanWithSuccess(config, kind);
198-
const endSpanWithError = createEndSpanWithError(config, kind);
185+
export const createServerInterceptor = (config: ConnectNodeInstrumentationConfig, diag: DiagLogger, tracer: Tracer) => {
186+
const startSpan = createStartSpan(config, tracer, 'server');
187+
const endSpanWithSuccess = createEndSpanWithSuccess(config, 'server');
188+
const endSpanWithError = createEndSpanWithError(config, 'server');
199189

200190
return (next: InterceptorAnyFn): InterceptorAnyFn =>
201191
async req => {

0 commit comments

Comments
 (0)