Java Code Examples for io.opentracing.noop.NoopTracerFactory#create()
The following examples show how to use
io.opentracing.noop.NoopTracerFactory#create() .
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: TracerFactory.java From Jupiter with Apache License 2.0 | 6 votes |
private static Tracer loadTracer() { try { Iterator<Tracer> implementations = JServiceLoader.load(Tracer.class).iterator(); if (implementations.hasNext()) { Tracer first = implementations.next(); if (!implementations.hasNext()) { return first; } logger.warn("More than one tracer is found, NoopTracer will be used as default."); return NoopTracerFactory.create(); } } catch (Throwable t) { logger.error("Load tracer failed: {}.", StackTraceUtil.stackTrace(t)); } return NoopTracerFactory.create(); }
Example 2
Source File: HonoClientUnitTestHelper.java From hono with Eclipse Public License 2.0 | 6 votes |
/** * Creates a mocked Hono connection that returns a * Noop Tracer. * * @param vertx The vert.x instance to use. * @param props The client properties to use. * @return The connection. */ public static HonoConnection mockHonoConnection(final Vertx vertx, final ClientConfigProperties props) { final Tracer tracer = NoopTracerFactory.create(); final HonoConnection connection = mock(HonoConnection.class); when(connection.getVertx()).thenReturn(vertx); when(connection.getConfig()).thenReturn(props); when(connection.getTracer()).thenReturn(tracer); when(connection.executeOnContext(VertxMockSupport.anyHandler())).then(invocation -> { final Promise<?> result = Promise.promise(); final Handler<Future<?>> handler = invocation.getArgument(0); handler.handle(result.future()); return result.future(); }); return connection; }
Example 3
Source File: TestRemoteNodeFileSystemDual.java From dremio-oss with Apache License 2.0 | 6 votes |
public ServiceHolder(Provider<Iterable<NodeEndpoint>> nodeProvider, PDFSMode mode, String name) throws Exception{ this.allocator = allocatorRule.newAllocator(name, 0, Long.MAX_VALUE); pool = new CloseableThreadPool(name); fabric = new FabricServiceImpl(HOSTNAME, 9970, true, THREAD_COUNT, this.allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); fabric.start(); endpoint = NodeEndpoint.newBuilder() .setAddress(fabric.getAddress()).setFabricPort(fabric.getPort()) .setRoles(Roles.newBuilder().setJavaExecutor(mode == PDFSMode.DATA)) .build(); service = new PDFSService(DirectProvider.wrap((FabricService) fabric), DirectProvider.wrap(endpoint), nodeProvider, NoopTracerFactory.create(), DremioTest.DEFAULT_SABOT_CONFIG, this.allocator, mode); service.start(); fileSystem = service.createFileSystem(); }
Example 4
Source File: LogTracer.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Override public Tracer getTracer(String serviceName) { boolean LogEnabled = Boolean.valueOf(configuration.getFirstProperty(TracingConstants.LOG_ENABLED)); if (LogEnabled) { Tracer tracer = NoopTracerFactory.create(); Reporter reporter = new TracingReporter(LogFactory.getLog(TracingConstants.TRACER)); Tracer tracerR = new TracerR(tracer, reporter, new ThreadLocalScopeManager()); GlobalTracer.register(tracerR); return tracerR; } return null; }
Example 5
Source File: TracingUtil.java From oxd with Apache License 2.0 | 5 votes |
private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { return NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); return new Configuration(componentName) .withSampler(samplerConfig) .withReporter(reporterConfig) .getTracer(); } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); return BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { return NoopTracerFactory.create(); } }
Example 6
Source File: UsernamePasswordAuthProviderTest.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Sets up the fixture. */ @BeforeEach public void setUp() { credentialsClient = mock(CredentialsClient.class); credentialsClientFactory = mock(CredentialsClientFactory.class); when(credentialsClientFactory.getOrCreateCredentialsClient("DEFAULT_TENANT")).thenReturn(Future.succeededFuture(credentialsClient)); pwdEncoder = mock(HonoPasswordEncoder.class); when(pwdEncoder.matches(eq("the-secret"), any(JsonObject.class))).thenReturn(true); provider = new UsernamePasswordAuthProvider(credentialsClientFactory, pwdEncoder, new ServiceConfigProperties(), NoopTracerFactory.create()); givenCredentialsOnRecord(CredentialsObject.fromClearTextPassword("4711", "device", "the-secret", null, null)); }
Example 7
Source File: HonoBasicAuthHandlerTest.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Verifies that the handler returns the status code {@link HttpURLConnection#HTTP_BAD_REQUEST} in case of malformed * authorization header. */ @SuppressWarnings({ "unchecked" }) @Test public void testHandleFailsForMalformedAuthorizationHeader() { authHandler = new HonoBasicAuthHandler(authProvider, "test", NoopTracerFactory.create()); final ArgumentCaptor<Throwable> exceptionCaptor = ArgumentCaptor.forClass(Throwable.class); // WHEN trying to authenticate a request using the HTTP BASIC scheme final String authorization = "BASIC test test"; final MultiMap headers = mock(MultiMap.class); when(headers.get(eq(HttpHeaders.AUTHORIZATION))).thenReturn(authorization); final HttpServerRequest req = mock(HttpServerRequest.class); when(req.headers()).thenReturn(headers); final HttpServerResponse resp = mock(HttpServerResponse.class); final RoutingContext ctx = mock(RoutingContext.class); when(ctx.request()).thenReturn(req); when(ctx.response()).thenReturn(resp); when(ctx.currentRoute()).thenReturn(mock(Route.class)); authHandler.parseCredentials(ctx, mock(Handler.class)); // THEN the request context is failed with the 400 error code verify(ctx).fail(exceptionCaptor.capture()); assertThat(exceptionCaptor.getValue()).isInstanceOf(ClientErrorException.class); assertThat(((ClientErrorException) exceptionCaptor.getValue()).getErrorCode()) .isEqualTo(HttpURLConnection.HTTP_BAD_REQUEST); }
Example 8
Source File: HonoBasicAuthHandlerTest.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Sets up the fixture. */ @BeforeEach public void setUp() { authProvider = mock(AuthProvider.class); authHandler = new HonoBasicAuthHandler(authProvider, "test", NoopTracerFactory.create()) { @Override public void parseCredentials(final RoutingContext context, final Handler<AsyncResult<JsonObject>> handler) { handler.handle(Future.succeededFuture(new JsonObject())); } }; }
Example 9
Source File: ConnectPacketAuthHandlerTest.java From hono with Eclipse Public License 2.0 | 5 votes |
/** * Sets up the fixture. */ @SuppressWarnings("unchecked") @BeforeEach public void setUp() { authProvider = mock(HonoClientBasedAuthProvider.class); authHandler = new ConnectPacketAuthHandler(authProvider, NoopTracerFactory.create()); }
Example 10
Source File: PDFSService.java From dremio-oss with Apache License 2.0 | 5 votes |
@VisibleForTesting public PDFSService( Provider<FabricService> fabricService, Provider<NodeEndpoint> nodeEndpointProvider, Provider<Iterable<NodeEndpoint>> executorsProvider, SabotConfig config, BufferAllocator allocator ) { this(fabricService, nodeEndpointProvider, executorsProvider, NoopTracerFactory.create(), config, allocator, PDFSMode.DATA); }
Example 11
Source File: InstrumentationConfig.java From feast with Apache License 2.0 | 5 votes |
@Bean public Tracer tracer() { if (!feastProperties.getTracing().isEnabled()) { return NoopTracerFactory.create(); } if (!feastProperties.getTracing().getTracerName().equalsIgnoreCase("jaeger")) { throw new IllegalArgumentException("Only 'jaeger' tracer is supported for now."); } return io.jaegertracing.Configuration.fromEnv(feastProperties.getTracing().getServiceName()) .getTracer(); }
Example 12
Source File: TestBoundCommandPool.java From dremio-oss with Apache License 2.0 | 4 votes |
private CommandPool newTestCommandPool() { return new BoundCommandPool(1, NoopTracerFactory.create()); }
Example 13
Source File: GrpcTracerFacade.java From dremio-oss with Apache License 2.0 | 4 votes |
private Tracer getTracer() { return tracer.getTracer() instanceof OpenCensusTracerAdapter ? NoopTracerFactory.create() : tracer; }
Example 14
Source File: OverrideTracerTest.java From java-web-servlet-filter with Apache License 2.0 | 4 votes |
@Override protected Filter tracingFilter() { // Initialize the filter with the NoopTracer return new TracingFilter(NoopTracerFactory.create(), Collections.singletonList(ServletFilterSpanDecorator.STANDARD_TAGS), Pattern.compile("/health")); }
Example 15
Source File: DefaultRiptideConfigurerTest.java From riptide with MIT License | 4 votes |
@Bean Tracer tracer() { return NoopTracerFactory.create(); }
Example 16
Source File: DefaultRiptideConfigurerTest.java From riptide with MIT License | 4 votes |
@Bean Tracer opentracingTracer() { return NoopTracerFactory.create(); }
Example 17
Source File: WorkItemTest.java From batfish with Apache License 2.0 | 4 votes |
@BeforeClass public static void initTracer() { _mockTracer = new MockTracer(); _noopTracer = NoopTracerFactory.create(); }
Example 18
Source File: TenantServiceImplTest.java From enmasse with Apache License 2.0 | 4 votes |
public TenantServiceImplTest() { this.service = new TenantServiceImpl(); this.service.configuration = new TenantServiceConfigProperties(); this.service.tracer = NoopTracerFactory.create(); }
Example 19
Source File: PrometheusBasedResourceLimitChecks.java From hono with Eclipse Public License 2.0 | 3 votes |
/** * Creates new checks. * * @param webClient The client to use for querying the Prometheus server. * @param config The PrometheusBasedResourceLimitChecks configuration object. * @param cacheProvider The cache provider to use for creating caches for metrics data retrieved * from the prometheus backend or {@code null} if they should not be cached. * @throws NullPointerException if any of the parameters except cacheProvider are {@code null}. */ public PrometheusBasedResourceLimitChecks( final WebClient webClient, final PrometheusBasedResourceLimitChecksConfig config, final CacheProvider cacheProvider) { this(webClient, config, cacheProvider, NoopTracerFactory.create()); }
Example 20
Source File: TenantServiceBasedX509Authentication.java From hono with Eclipse Public License 2.0 | 2 votes |
/** * Creates a new instance for a Tenant service client. * * @param tenantClientFactory The factory to use for creating a Tenant service client. */ public TenantServiceBasedX509Authentication(final TenantClientFactory tenantClientFactory) { this(tenantClientFactory, NoopTracerFactory.create()); }