amplication / amplication/amplication

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

Aperta
#8,387 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
type: bug
Lingua principale
TypeScript
Stelle
16k
Fork
1.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.