Skip to content

Commit

Permalink
fix(otel): order of using TraceMiddlewareInnerGRpc
Browse files Browse the repository at this point in the history
  • Loading branch information
waitingsong committed Oct 29, 2024
1 parent a92309e commit 3e56a14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/otel/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ export class AutoConfiguration implements ILifeCycle {

if (this.config.enable) {
registerMiddleware(this.app, TraceMiddlewareInner, 'last')
// registerMiddleware(this.grpcApp as unknown as Application, TraceMiddlewareInnerGRpc, 'last')

const grpcFramework = this.frameworkService.getFramework('gRPC')
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (grpcFramework) {
registerMiddleware(grpcFramework.getApplication() as unknown as Application, TraceMiddlewareInnerGRpc, 'first')
const rpcApp = grpcFramework.getApplication() as unknown as Application
registerMiddleware(rpcApp, TraceMiddlewareInnerGRpc, 'last')
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/otel/src/imports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as grpc from '@midwayjs/grpc'
// import * as grpc from '@midwayjs/grpc'
import * as info from '@midwayjs/info'
import * as koa from '@midwayjs/koa'
import * as swagger from '@midwayjs/swagger'
Expand All @@ -17,7 +17,7 @@ if (CI) {
useComponents.push(koa)
useComponents.push(info)
useComponents.push(swagger)
useComponents.push(grpc)
// useComponents.push(grpc)
}

useComponents.push(share)
Expand Down

0 comments on commit 3e56a14

Please sign in to comment.