Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traces from micronaut app are not visible in Jaeger #2209

Closed
ZeinabAshjaei opened this issue Oct 9, 2019 · 9 comments
Closed

Traces from micronaut app are not visible in Jaeger #2209

ZeinabAshjaei opened this issue Oct 9, 2019 · 9 comments
Assignees
Labels
info: workaround available A workaround is available for the issue
Milestone

Comments

@ZeinabAshjaei
Copy link

I have an instrumented micronaut application. If I configure localhost jaeger to see the traces, it would be fine, but the same configuration for a customized jaeger endpoint is not working. It seems that micronaut configuration for tracing supports only localhost.

  • Steps to reproduce

Bring up a customized jaeger, not localhost and set its endpoint and port in the application.yaml file, like the way it has been explained in the documentation.
https://guides.micronaut.io/micronaut-microservices-distributed-tracing-jaeger/guide/index.html

Expected Behaviour

To see spans in jaeger UI.

Actual Behaviour

The application is not in the list of services.

Environment Information

  • Micronaut Version: 1.2.0
  • JDK Version: 8

The same issue is reported in stackoverflow:
https://stackoverflow.com/questions/58249869/micronaut-and-opentracing-of-method-calls

@graemerocher
Copy link
Contributor

There were some issues that were resolved with Jaeger in Micronaut 1.2.3

Please could you upgrade to the latest version and verify again?

@ZeinabAshjaei
Copy link
Author

I upgraded to 1.2.3, but did not help.

@graemerocher
Copy link
Contributor

Please provide an example that reproduces the issue

@ZeinabAshjaei
Copy link
Author

ZeinabAshjaei commented Oct 10, 2019

I think the explanation is clear, in order to configure tracing, we need to set jaeger endpoint and port like this:

---
tracing:
  jaeger:
    enabled: true
    sampler:
      probability: 1
    sender:
      agentHost: "**jaeger endpoint**"
      agentPort: "**jaeger port**"

If I bring up a localhost all-in-one jaeger using docker and replace the jaeger endpoint with localhost and the port to 14268, traces are visible in jaeger, but if I want to use another jaeger server than localhost, it does not show any traces. My jaeger server is up and running, since other non-micronaut services are sending their traces to jaeger. I guess the configuration of the tracing in micronaut is so that it could only support localhost.

@graemerocher
Copy link
Contributor

graemerocher commented Oct 10, 2019

As a workaround you can define the following bean:

import io.jaegertracing.Configuration;
import io.jaegertracing.Configuration.SenderConfiguration;

@Factory
class MySenderConfig {

     @Singleton
     SenderConfiguration senderConfig() {
           SenderConfiguration config = SenderConfiguration.fromEnv();
           config.withAgentHost("**jaeger endpoint**");
           config.withAgentPort(14268);
           return config;
     }
}

@graemerocher graemerocher added this to the 1.2.4 milestone Oct 10, 2019
@graemerocher graemerocher added info: workaround available A workaround is available for the issue and removed status: awaiting feedback labels Oct 10, 2019
@graemerocher graemerocher self-assigned this Oct 10, 2019
@ZeinabAshjaei
Copy link
Author

Thank you for the workaround, but it could not resolve my issue.

@zouxiang
Copy link

@ZeinabAshjaei I have the same issue with you

@graemerocher
Copy link
Contributor

Apologies, this should work until 1.2.4 is out:

import javax.inject.Singleton;

import io.jaegertracing.Configuration.ReporterConfiguration;
import io.jaegertracing.Configuration.SenderConfiguration;
import io.micronaut.context.event.BeanCreatedEvent;
import io.micronaut.context.event.BeanCreatedEventListener;
import io.micronaut.tracing.jaeger.JaegerConfiguration;

@Singleton
class CustomJaegerConfiguration implements BeanCreatedEventListener<JaegerConfiguration> {

    @Override
    public JaegerConfiguration onCreated(BeanCreatedEvent<JaegerConfiguration> event) {
        JaegerConfiguration config = event.getBean();
        ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv();
        SenderConfiguration senderConfig = SenderConfiguration.fromEnv();
        senderConfig.withAgentHost("**jaeger endpoint**");
        senderConfig.withAgentPort(14268);
        reporterConfig.withSender(
            senderConfig
        );
        config.setReporterConfiguration(reporterConfig);
        return config;
    }

}

@bkamau
Copy link

bkamau commented Nov 15, 2019

Am not sure why but using agentPort: 14268 did not work in my case, however agentPort: 6831 did work. Maybe the documentation can expound a bit in configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info: workaround available A workaround is available for the issue
Projects
None yet
Development

No branches or pull requests

4 participants