amplication / amplication/amplication
🐛 Bug Report: @amplication/opentelemetry-nestjs irrelevant spans appear in trace info when the same guard decorates multiple handlers
- 主要语言
- TypeScript
- 星标
- 16k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
描述
### What happened?
Traces for an http endpoint inside a controller, that has a `Guard` shows irrelevant spans for all other methods decorated with the same guard.

When hitting the following controller as `curl http://localhost:8080/`
```typescript
@Controller()
export class AppController {
constructor(
private readonly appService: AppService,
private readonly logger: PinoLoggerService,
) {}
@Get()
@UseGuards(SampleGuard)
getHello(): string {
this.logger.log('Hello world');
return this.appService.getHello();
}
@Get('/metrics')
@UseGuards(SampleGuard)
getMetrics() {
return client.register.metrics();
}
@Get('foo')
@UseGuards(SampleGuard)
foo() {}
@Get('bar')
@UseGuards(SampleGuard)
bar() {}
}
```
there are spans for every method in the controller that is decorated with the same guards as the one we've hit.
### What you expected to happen
I expect to only see span information related to the handler actually being invoked.
### How to reproduce
- setup telemetry
- create a controller with multiple handlers that have the same guard
- hit a single one of those endpoints
- view trace information in relevant exporter platform
my entire setup can be found here: https://github.com/ssilve1989/opentelemetry-poc/tree/bug/redundant-guard-traces
### Amplication version
_No response_
### Environment
Node: v20.11.1
Docker: 25.0.5, build 5dc9bcc
Zipkin: v3.3.0 commit dfd8ee2
@amplication/opentelemetry-nestjs: 5.0.3
### Are you willing to submit PR?
Yes I am willing to submit a PR!
贡献指南
评估
这个 Issue 还没有评估数据。