zipkin2.storage.StorageComponent Java Examples

The following examples show how to use zipkin2.storage.StorageComponent. 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: ZipkinHttpCollector.java    From pivotal-bank-demo with Apache License 2.0 6 votes vote down vote up
@Autowired
ZipkinHttpCollector(
    StorageComponent storage, CollectorSampler sampler, CollectorMetrics metrics) {
  this.metrics = metrics.forTransport("http");
  this.collector =
      Collector.newBuilder(getClass())
          .storage(storage)
          .sampler(sampler)
          .metrics(this.metrics)
          .build();
  this.JSON_V2 = new HttpCollector(SpanBytesDecoder.JSON_V2);
  this.PROTO3 = new HttpCollector(SpanBytesDecoder.PROTO3);
  this.JSON_V1 = new HttpCollector(SpanBytesDecoder.JSON_V1);
  this.THRIFT = new HttpCollector(SpanBytesDecoder.THRIFT);
  this.errorCallback =
      new Receiver.ErrorCallback() {
        @Override
        public void error(HttpServerExchange exchange, IOException e) {
          ZipkinHttpCollector.this.metrics.incrementMessagesDropped();
          ZipkinHttpCollector.error(exchange, e);
        }
      };
}
 
Example #2
Source File: ZipkinSQSCollectorModule.java    From zipkin-aws with Apache License 2.0 6 votes vote down vote up
@Bean
SQSCollector sqsCollector(
    ZipkinSQSCollectorProperties properties,
    AWSCredentialsProvider credentialsProvider,
    CollectorSampler sampler,
    CollectorMetrics metrics,
    StorageComponent storage) {
  return properties
      .toBuilder()
      .queueUrl(properties.getQueueUrl())
      .waitTimeSeconds(properties.getWaitTimeSeconds())
      .parallelism(properties.getParallelism())
      .endpointConfiguration(endpointConfiguration)
      .credentialsProvider(credentialsProvider)
      .sampler(sampler)
      .metrics(metrics)
      .storage(storage)
      .build()
      .start();
}
 
Example #3
Source File: ZipkinKinesisCollectorModule.java    From zipkin-aws with Apache License 2.0 6 votes vote down vote up
@Bean
KinesisCollector kinesisCollector(
    ZipkinKinesisCollectorProperties properties,
    AWSCredentialsProvider credentialsProvider,
    CollectorSampler sampler,
    CollectorMetrics metrics,
    StorageComponent storage) {
  return KinesisCollector.newBuilder()
      .credentialsProvider(credentialsProvider)
      .sampler(sampler)
      .metrics(metrics)
      .storage(storage)
      .streamName(properties.getStreamName())
      .appName(properties.getAppName())
      .regionName(properties.getAwsKinesisRegion())
      .build()
      .start();
}
 
Example #4
Source File: ZipkinServerConfiguration.java    From pivotal-bank-demo with Apache License 2.0 5 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
  if (tracing == null) return bean;
  if (bean instanceof StorageComponent) {
    return new TracingStorageComponent(tracing, (StorageComponent) bean);
  }
  return bean;
}
 
Example #5
Source File: ZipkinServerConfiguration.java    From pivotal-bank-demo with Apache License 2.0 5 votes vote down vote up
@Bean
StorageComponent storage(
    @Value("${zipkin.storage.strict-trace-id:true}") boolean strictTraceId,
    @Value("${zipkin.storage.search-enabled:true}") boolean searchEnabled,
    @Value("${zipkin.storage.mem.max-spans:500000}") int maxSpans) {
  return InMemoryStorage.newBuilder()
      .strictTraceId(strictTraceId)
      .searchEnabled(searchEnabled)
      .maxSpanCount(maxSpans)
      .build();
}
 
Example #6
Source File: ZipkinQueryApiV2.java    From pivotal-bank-demo with Apache License 2.0 5 votes vote down vote up
ZipkinQueryApiV2(
    StorageComponent storage,
    @Value("${zipkin.storage.type:mem}") String storageType,
    @Value("${zipkin.query.lookback:86400000}") long defaultLookback, // 1 day in millis
    @Value("${zipkin.query.names-max-age:300}") int namesMaxAge // 5 minutes
    ) {
  this.storage = storage;
  this.storageType = storageType;
  this.defaultLookback = defaultLookback;
  this.namesMaxAge = namesMaxAge;
}
 
Example #7
Source File: ZipkinServerConfigurationTest.java    From pivotal-bank-demo with Apache License 2.0 5 votes vote down vote up
@Test public void search_canDisable() {
  addEnvironment(context, "zipkin.storage.search-enabled:false");
  context.register(
    PropertyPlaceholderAutoConfiguration.class,
    ZipkinServerConfigurationTest.Config.class,
    ZipkinServerConfiguration.class
  );
  context.refresh();

  StorageComponent v2Storage = context.getBean(StorageComponent.class);
  assertThat(v2Storage)
    .extracting("searchEnabled")
    .containsExactly(false);
}
 
Example #8
Source File: ZipkinKafkaStorageModule.java    From zipkin-storage-kafka with Apache License 2.0 5 votes vote down vote up
@ConditionalOnMissingBean @Bean StorageComponent storage(
    @Value("${zipkin.storage.search-enabled:true}") boolean searchEnabled,
    @Value("${zipkin.storage.autocomplete-keys:}") List<String> autocompleteKeys,
    @Value("${server.port:9411}") int port,
    ZipkinKafkaStorageProperties properties) {
  return properties.toBuilder()
      .searchEnabled(searchEnabled)
      .autocompleteKeys(autocompleteKeys)
      .serverPort(port)
      .build();
}
 
Example #9
Source File: ZipkinXRayStorageModule.java    From zipkin-aws with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
StorageComponent storage(
    ZipkinXRayStorageProperties properties,
    @Value("${zipkin.storage.strict-trace-id:true}") boolean strictTraceId) {
  return properties.toBuilder().strictTraceId(strictTraceId).build();
}
 
Example #10
Source File: SQSCollector.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Override
public Builder storage(StorageComponent storageComponent) {
  delegate.storage(storageComponent);
  return this;
}
 
Example #11
Source File: ITMySQLDependencies.java    From zipkin-dependencies with Apache License 2.0 4 votes vote down vote up
@Override protected StorageComponent.Builder newStorageBuilder(TestInfo testInfo) {
  return backend.computeStorageBuilder();
}
 
Example #12
Source File: ITElasticsearchDependencies.java    From zipkin-dependencies with Apache License 2.0 4 votes vote down vote up
@Override protected StorageComponent.Builder newStorageBuilder(TestInfo testInfo) {
  index = testInfo.getTestClass().get().getName().toLowerCase();
  if (index.length() > 48) index = index.substring(index.length() - 48);
  return backend().computeStorageBuilder().index(index);
}
 
Example #13
Source File: ITCassandraDependencies.java    From zipkin-dependencies with Apache License 2.0 4 votes vote down vote up
@Override protected StorageComponent.Builder newStorageBuilder(TestInfo testInfo) {
  keyspace = testInfo.getTestMethod().get().getName().toLowerCase();
  if (keyspace.length() > 48) keyspace = keyspace.substring(keyspace.length() - 48);
  return backend.computeStorageBuilder().keyspace(keyspace);
}
 
Example #14
Source File: ITCassandraDependencies.java    From zipkin-dependencies with Apache License 2.0 4 votes vote down vote up
@Override protected StorageComponent.Builder newStorageBuilder(TestInfo testInfo) {
  keyspace = testInfo.getTestMethod().get().getName().toLowerCase();
  if (keyspace.length() > 48) keyspace = keyspace.substring(keyspace.length() - 48);
  return backend.computeStorageBuilder().keyspace(keyspace);
}
 
Example #15
Source File: ZipkinStackdriverStorageModule.java    From zipkin-gcp with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
StorageComponent storage(
    @Value("${zipkin.storage.strict-trace-id:true}") boolean strictTraceId,
    @Qualifier("projectId") String projectId,
    ClientFactory clientFactory,
    ZipkinStackdriverStorageProperties properties,
    Credentials credentials) {
  if (!OpenSsl.isAvailable() && !jettyAlpnAvailable()) {
    throw new IllegalStateException(
        "OpenSsl or ALPN is required. This usually requires either JDK9+, jetty-alpn, or "
            + "netty-tcnative-boringssl-static");
  }

  ClientOptionsBuilder options = ClientOptions.builder();

  HttpLogging httpLogging = properties.getHttpLogging();
  if (httpLogging != HttpLogging.NONE) {
    LoggingClientBuilder loggingBuilder = LoggingClient.builder()
        .requestLogLevel(LogLevel.INFO)
        .successfulResponseLogLevel(LogLevel.INFO);
    switch (httpLogging) {
      case HEADERS:
        loggingBuilder.contentSanitizer(unused -> "");
        break;
      case BASIC:
        loggingBuilder.contentSanitizer(unused -> "");
        loggingBuilder.headersSanitizer(unused -> HttpHeaders.of());
        break;
      default:
        break;
    }
    options.decorator(loggingBuilder.newDecorator());
  }

  return StackdriverStorage.newBuilder(properties.getApiHost())
      .projectId(projectId)
      .strictTraceId(strictTraceId)
      .clientFactory(clientFactory)
      .clientOptions(options
          .decorator(CredentialsDecoratingClient.newDecorator(credentials))
          .build())
      .build();
}
 
Example #16
Source File: KinesisCollector.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Override
public Builder storage(StorageComponent storageComponent) {
  delegate.storage(storageComponent);
  return this;
}
 
Example #17
Source File: ZipkinKinesisCollectorModuleTest.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Bean
StorageComponent storage() {
  return InMemoryStorage.newBuilder().build();
}
 
Example #18
Source File: ZipkinSQSCollectorModuleTest.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Bean
StorageComponent storage() {
  return InMemoryStorage.newBuilder().build();
}
 
Example #19
Source File: TracingStorageComponent.java    From pivotal-bank-demo with Apache License 2.0 4 votes vote down vote up
public TracingStorageComponent(Tracing tracing, StorageComponent delegate) {
  this.tracing = tracing;
  this.delegate = delegate;
}
 
Example #20
Source File: TracingConfiguration.java    From pivotal-bank-demo with Apache License 2.0 4 votes vote down vote up
LocalSender(StorageComponent delegate) {
  this.delegate = delegate;
}
 
Example #21
Source File: TracingConfiguration.java    From pivotal-bank-demo with Apache License 2.0 4 votes vote down vote up
@Bean
Sender sender(@Lazy StorageComponent storage) {
  return new LocalSender(storage);
}
 
Example #22
Source File: KafkaStorageBuilder.java    From zipkin-storage-kafka with Apache License 2.0 4 votes vote down vote up
@Override public StorageComponent build() {
  return new KafkaStorage(this);
}
 
Example #23
Source File: ZipkinKafkaStorageModule.java    From zipkin-storage-kafka with Apache License 2.0 4 votes vote down vote up
@Bean public ArmeriaServerConfigurator storageHttpService(StorageComponent storage) {
  return sb -> sb.annotatedService(HTTP_PATH_PREFIX, ((KafkaStorage) storage).httpService());
}