quarkusio.github.io icon indicating copy to clipboard operation
quarkusio.github.io copied to clipboard

Should Custom ID Generator bean example be eagerly initialized

Open rapphil opened this issue 2 years ago • 0 comments

Describe the bug Should this example for setting up a custom id generator for OpenTelemetry with Quarkus be eagerly initialized?

@Singleton
public class CustomConfiguration {

    /** Creates a custom IdGenerator for OpenTelemetry */
    @Produces
    @Singleton
    public IdGenerator idGenerator() {
        return AwsXrayIdGenerator.getInstance();
    }
}

Should this be?

@Startup
@Singleton
public class CustomConfiguration {

    /** Creates a custom IdGenerator for OpenTelemetry */
    @Produces
    @Singleton
    public IdGenerator idGenerator() {
        return AwsXrayIdGenerator.getInstance();
    }
}

Alternative:

If we don't go with the eager initialization, should we advise in the documentation that the IdGenerator must be explicitly injected for it to be used?

Which pages https://quarkus.io/guides/opentelemetry#id-generator

rapphil avatar Mar 28 '23 00:03 rapphil