opentelemetry-go
opentelemetry-go copied to clipboard
Proposal: Pattern on when to return `ctx.Err()`
Based on: https://github.com/open-telemetry/opentelemetry-go/pull/3990
A function SHOULD NOT return ctx.Err() if the method was not interrupted because of the context passed to a function.
For instance:
1 .There is a func (srv *Service) Shutdown(ctx context.Context) error
2. The Shudown is called the first time.
3. A canceled ctx is passed
4. There is "no work in progress". Therefore, the service can be immediately shutdown.
5. nil is returned as Shutdown succeeded and nothing had to be interrupted.
As part of this issue I propose to
- Describe the pattern in
CONTRIBUTING.md - we can create bugs for places when we see that this pattern is not followed (e.g. in exporter's shutdown)
Hi @pellared I am interested in contributing to the 2nd point mentioned above, Could you help me with creating initial bug/issue to get started with? Thanks.
@Kaushal28
- Find places where this pattern is not followed
- For each create an an issue and reference this one as a pattern (e.g. you can write
Part of #3991) in the description.