amplication / amplication/amplication

🐛 Bug Report: @amplication/opentelemetry-nestjs irrelevant spans appear in trace info when the same guard decorates multiple handlers

未关闭
#8,387 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
type: bug
主要语言
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.
![Screenshot 2024-05-03 at 11 37 47 AM](https://github.com/amplication/amplication/assets/3699455/4d991893-9f87-4382-98fe-291e81c41e61)

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 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。