io.jaegertracing.Configuration.ReporterConfiguration Java Examples
The following examples show how to use
io.jaegertracing.Configuration.ReporterConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Client.java From cxf with Apache License 2.0 | 6 votes |
public static void main(final String[] args) throws Exception { final Tracer tracer = new Configuration("tracer-client") .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)) .withReporter(new ReporterConfiguration().withSender( new SenderConfiguration() { @Override public Sender getSender() { return new Slf4jLogSender(); } } )) .getTracer(); final OpenTracingClientProvider provider = new OpenTracingClientProvider(tracer); final Response response = WebClient .create("http://localhost:9000/catalog", Arrays.asList(provider)) .accept(MediaType.APPLICATION_JSON) .get(); System.out.println(response.readEntity(String.class)); response.close(); }
Example #2
Source File: Server.java From cxf with Apache License 2.0 | 6 votes |
@Bean Tracer tracer() { return new Configuration("camel-server") .withSampler( new SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1)) .withReporter(new ReporterConfiguration().withSender( new SenderConfiguration() .withEndpoint("http://localhost:14268/api/traces") )) .withCodec( new CodecConfiguration() .withCodec(Builtin.TEXT_MAP, new TextMapCodec(true)) ) .getTracer(); }
Example #3
Source File: OpenTracingUtil.java From problematic-microservices with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static void configureOpenTracing(Properties configuration, String serviceName) { Tracer tracer = null; String tracerName = configuration.getProperty("tracer"); if ("jaeger".equals(tracerName)) { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1); SenderConfiguration senderConfig = new SenderConfiguration() .withAgentHost(configuration.getProperty("jaeger.reporter.host")) .withAgentPort(Integer.decode(configuration.getProperty("jaeger.reporter.port"))); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true) .withFlushInterval(1000).withMaxQueueSize(10000).withSender(senderConfig); tracer = new Configuration(serviceName).withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create("http://" + configuration.getProperty("zipkin.reporter.host") + ":" + configuration.getProperty("zipkin.reporter.port") + "/api/v2/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); tracer = BraveTracer .create(Tracing.newBuilder().localServiceName(serviceName).spanReporter(reporter).build()); } GlobalTracer.register(new DelegatingJfrTracer(tracer)); }
Example #4
Source File: Client.java From cxf with Apache License 2.0 | 6 votes |
public static void main(final String[] args) throws Exception { final Tracer tracer = new Configuration("cxf-client") .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)) .withReporter(new ReporterConfiguration().withSender( new SenderConfiguration() .withEndpoint("http://localhost:14268/api/traces") )) .getTracer(); final OpenTracingClientProvider provider = new OpenTracingClientProvider(tracer); final javax.ws.rs.client.Client client = ClientBuilder.newClient().register(provider); final Response response = client .target("http://localhost:8084/catalog") .request() .accept(MediaType.APPLICATION_JSON) .get(); LOG.info("Response: {}", response.readEntity(String.class)); response.close(); // Allow Tracer to flush Thread.sleep(1000); }
Example #5
Source File: JaegerConfigurator.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public Tracer getTracer() { SamplerConfiguration sampleConf = SamplerConfiguration.fromEnv() .withType(type); if (param != null) { sampleConf.withParam(param); } ReporterConfiguration reportConf = ReporterConfiguration.fromEnv() .withLogSpans(logSpans); Configuration config = new Configuration(name) .withReporter(reportConf) .withSampler(sampleConf); // If the user gets rid of their tracer config and then puts it back, we want to get a fresh tracer since the old // one will be closed. return config.getTracer(); }
Example #6
Source File: ImplementationsJFRTest.java From java-jfr-tracer with Apache License 2.0 | 5 votes |
@Test public void jaegerB3() throws IOException { System.setProperty(JAEGER_SAMPLER_TYPE, "const"); System.setProperty(JAEGER_SAMPLER_PARAM, "1"); System.setProperty(JAEGER_AGENT_HOST, "localhost"); System.setProperty(JAEGER_AGENT_PORT, "6831"); System.setProperty(JAEGER_PROPAGATION, "B3"); Tracer jaegerTracer = new io.jaegertracing.Configuration("test").withSampler(SamplerConfiguration.fromEnv()) .withCodec(CodecConfiguration.fromEnv()).withReporter(ReporterConfiguration.fromEnv()).getTracer(); innerTest(jaegerTracer); }
Example #7
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected Server() throws Exception { org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000); // Register and map the dispatcher servlet final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet()); final ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.addServlet(servletHolder, "/*"); servletHolder.setInitParameter("javax.ws.rs.Application", CatalogApplication.class.getName()); final Tracer tracer = new Configuration("tracer-server") .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)) .withReporter(new ReporterConfiguration().withSender( new SenderConfiguration() { @Override public Sender getSender() { return new Slf4jLogSender(); } } )) .getTracer(); GlobalTracer.registerIfAbsent(tracer); server.setHandler(context); server.start(); server.join(); }
Example #8
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
@Bean @Qualifier("cxf") Tracer cxfTracer() { return new Configuration("cxf-service") .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)) .withReporter(new ReporterConfiguration().withSender( new SenderConfiguration() .withEndpoint("http://localhost:14268/api/traces") )) .getTracer(); }
Example #9
Source File: Driver.java From batfish with Apache License 2.0 | 5 votes |
private static void initTracer() { io.jaegertracing.Configuration config = new io.jaegertracing.Configuration(_mainSettings.getServiceName()) .withSampler(new SamplerConfiguration().withType("const").withParam(1)) .withReporter( new ReporterConfiguration() .withSender( SenderConfiguration.fromEnv() .withAgentHost(_mainSettings.getTracingAgentHost()) .withAgentPort(_mainSettings.getTracingAgentPort())) .withLogSpans(false)); GlobalTracer.registerIfAbsent(config.getTracer()); }
Example #10
Source File: Main.java From batfish with Apache License 2.0 | 5 votes |
private static void initTracer() { Configuration config = new Configuration(_settings.getServiceName()) .withSampler(new SamplerConfiguration().withType("const").withParam(1)) .withReporter( new ReporterConfiguration() .withSender( SenderConfiguration.fromEnv() .withAgentHost(_settings.getTracingAgentHost()) .withAgentPort(_settings.getTracingAgentPort())) .withLogSpans(false)); GlobalTracer.registerIfAbsent(config.getTracer()); }
Example #11
Source File: Client.java From batfish with Apache License 2.0 | 5 votes |
private void initTracer() { Configuration config = new Configuration(_settings.getServiceName()) .withSampler(new SamplerConfiguration().withType("const").withParam(1)) .withReporter( new ReporterConfiguration() .withSender( SenderConfiguration.fromEnv() .withAgentHost(_settings.getTracingAgentHost()) .withAgentPort(_settings.getTracingAgentPort())) .withLogSpans(false)); GlobalTracer.registerIfAbsent(config.getTracer()); }
Example #12
Source File: AllInOne.java From batfish with Apache License 2.0 | 5 votes |
private void initTracer() { Configuration config = new Configuration(_settings.getServiceName()) .withSampler(new SamplerConfiguration().withType("const").withParam(1)) .withReporter( new ReporterConfiguration() .withSender( SenderConfiguration.fromEnv() .withAgentHost(_settings.getTracingAgentHost()) .withAgentPort(_settings.getTracingAgentPort())) .withLogSpans(false)); GlobalTracer.registerIfAbsent(config.getTracer()); }
Example #13
Source File: Tracing.java From opentracing-tutorial with Apache License 2.0 | 5 votes |
public static JaegerTracer init(String service) { SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv() .withType(ConstSampler.TYPE) .withParam(1); ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv() .withLogSpans(true); Configuration config = new Configuration(service) .withSampler(samplerConfig) .withReporter(reporterConfig); return config.getTracer(); }
Example #14
Source File: JaegerTraceFactory.java From joyrpc with Apache License 2.0 | 5 votes |
/** * 构造报告配置 * * @param parametric 参数 * @return 报告配置 */ protected ReporterConfiguration buildReporterConfiguration(final Parametric parametric) { return new ReporterConfiguration() .withSender(buildSenderConfiguration(parametric)) .withFlushInterval(parametric.getPositive("JAEGER_REPORTER_FLUSH_INTERVAL", RemoteReporter.DEFAULT_FLUSH_INTERVAL_MS)) .withMaxQueueSize(parametric.getPositive("JAEGER_REPORTER_MAX_QUEUE_SIZE", RemoteReporter.DEFAULT_MAX_QUEUE_SIZE)) .withLogSpans(parametric.getBoolean("JAEGER_REPORTER_LOG_SPANS", true)); }
Example #15
Source File: ImplementationsJFRTest.java From java-jfr-tracer with Apache License 2.0 | 5 votes |
@Test public void jaegerUber() throws IOException { System.setProperty(JAEGER_SAMPLER_TYPE, "const"); System.setProperty(JAEGER_SAMPLER_PARAM, "1"); System.setProperty(JAEGER_AGENT_HOST, "localhost"); System.setProperty(JAEGER_AGENT_PORT, "6831"); System.setProperty(JAEGER_PROPAGATION, "JAEGER"); Tracer jaegerTracer = new io.jaegertracing.Configuration("test").withSampler(SamplerConfiguration.fromEnv()) .withCodec(CodecConfiguration.fromEnv()).withReporter(ReporterConfiguration.fromEnv()).getTracer(); innerTest(jaegerTracer); }
Example #16
Source File: ImplementationsJFRTest.java From java-jfr-tracer with Apache License 2.0 | 5 votes |
@Test public void jaegerB3() throws IOException { System.setProperty(JAEGER_SAMPLER_TYPE, "const"); System.setProperty(JAEGER_SAMPLER_PARAM, "1"); System.setProperty(JAEGER_AGENT_HOST, "localhost"); System.setProperty(JAEGER_AGENT_PORT, "6831"); System.setProperty(JAEGER_PROPAGATION, "B3"); Tracer jaegerTracer = new io.jaegertracing.Configuration("test").withSampler(SamplerConfiguration.fromEnv()) .withCodec(CodecConfiguration.fromEnv()).withReporter(ReporterConfiguration.fromEnv()).getTracer(); innerTest(jaegerTracer); }
Example #17
Source File: ImplementationsJFRTest.java From java-jfr-tracer with Apache License 2.0 | 5 votes |
@Test public void jaegerUber() throws IOException { System.setProperty(JAEGER_SAMPLER_TYPE, "const"); System.setProperty(JAEGER_SAMPLER_PARAM, "1"); System.setProperty(JAEGER_AGENT_HOST, "localhost"); System.setProperty(JAEGER_AGENT_PORT, "6831"); System.setProperty(JAEGER_PROPAGATION, "JAEGER"); Tracer jaegerTracer = new io.jaegertracing.Configuration("test").withSampler(SamplerConfiguration.fromEnv()) .withCodec(CodecConfiguration.fromEnv()).withReporter(ReporterConfiguration.fromEnv()).getTracer(); innerTest(jaegerTracer); }
Example #18
Source File: FApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-6-formatter").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #19
Source File: BBApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-4-bigbrother").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #20
Source File: FApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-4-formatter").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #21
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-4-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #22
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-3-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #23
Source File: BBApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-6-bigbrother").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #24
Source File: BBApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-4-bigbrother").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #25
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-6-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #26
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-3-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #27
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-2-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #28
Source File: HelloApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-5-hello").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #29
Source File: FApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-5-formatter").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }
Example #30
Source File: BBApp.java From Mastering-Distributed-Tracing with MIT License | 4 votes |
@Bean public io.opentracing.Tracer initTracer() { SamplerConfiguration samplerConfig = new SamplerConfiguration().withType("const").withParam(1); ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true); return new Configuration("java-5-bigbrother").withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); }