Skip to content

Commit

Permalink
Refactor packages structure (#343)
Browse files Browse the repository at this point in the history
* Tidy up package structure
  • Loading branch information
worldtiki authored May 28, 2021
1 parent a23c5f1 commit 801be7f
Show file tree
Hide file tree
Showing 55 changed files with 134 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack;
package com.expedia.pitchfork;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack;
package com.expedia.pitchfork;

import com.hotels.service.tracing.zipkintohaystack.ingresses.datadog.DatadogSpansMessagePackDecoder;
import com.hotels.service.tracing.zipkintohaystack.ingresses.datadog.DatadogSpansJsonDecoder;
import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import com.expedia.pitchfork.systems.datadog.ingress.DatadogSpansMessagePackDecoder;
import com.expedia.pitchfork.systems.datadog.ingress.DatadogSpansJsonDecoder;
import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import io.netty.handler.codec.http.HttpContentDecompressor;
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack;
package com.expedia.pitchfork;

import com.hotels.service.tracing.zipkintohaystack.forwarders.Fork;
import com.hotels.service.tracing.zipkintohaystack.forwarders.SpanForwarder;
import com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.SpanValidator;
import com.hotels.service.tracing.zipkintohaystack.ingresses.Decoder;
import com.expedia.pitchfork.systems.common.Fork;
import com.expedia.pitchfork.systems.common.SpanForwarder;
import com.expedia.pitchfork.systems.haystack.SpanValidator;
import com.expedia.pitchfork.systems.common.IngressDecoder;
import io.micrometer.core.instrument.Counter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -67,7 +67,7 @@ public Mono<ServerResponse> unmatched(ServerRequest serverRequest) {
* Valid requests made to this service will be handled by this function.
* It submits the reported spans to the registered {@link SpanForwarder} asynchronously and waits until they all complete.
*/
public Mono<ServerResponse> addSpans(ServerRequest serverRequest, Decoder decoder, Counter counter) {
public Mono<ServerResponse> addSpans(ServerRequest serverRequest, IngressDecoder decoder, Counter counter) {
return serverRequest
.bodyToMono(byte[].class)
.flatMapIterable(decodeList(decoder))
Expand All @@ -78,7 +78,7 @@ public Mono<ServerResponse> addSpans(ServerRequest serverRequest, Decoder decode
.then(ok().body(BodyInserters.empty()));
}

private Function<byte[], Iterable<Span>> decodeList(Decoder decoder) {
private Function<byte[], Iterable<Span>> decodeList(IngressDecoder decoder) {
return bytes -> (Collection<Span>) decoder.decodeList(bytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.metrics;
package com.expedia.pitchfork.monitoring.metrics;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders;
package com.expedia.pitchfork.systems.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hotels.service.tracing.zipkintohaystack.ingresses;
package com.expedia.pitchfork.systems.common;

import zipkin2.Span;

Expand All @@ -7,7 +7,7 @@
/**
* Contract for a decoder of bytes {@link Span}.
*/
public interface Decoder {
public interface IngressDecoder {

/**
* Returns a collection of spans from their serialized form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders;
package com.expedia.pitchfork.systems.common;

import zipkin2.Span;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog;
package com.expedia.pitchfork.systems.datadog;

import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.model.DatadogSpan;
import com.expedia.pitchfork.systems.datadog.model.DatadogSpan;
import zipkin2.Annotation;
import zipkin2.Endpoint;
import zipkin2.Span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog;
package com.expedia.pitchfork.systems.datadog.forwarder;

import com.hotels.service.tracing.zipkintohaystack.forwarders.SpanForwarder;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.properties.DatadogForwarderConfigProperties;
import com.expedia.pitchfork.systems.common.SpanForwarder;
import com.expedia.pitchfork.systems.datadog.forwarder.properties.DatadogForwarderConfigProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void initialize() {

@Override
public void process(Span span) {
logger.info("operation=process, span={}", span);
logger.debug("operation=process, span={}", span);

spansDispatcher.addSpan(span);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog;
package com.expedia.pitchfork.systems.datadog.forwarder;

import com.expedia.pitchfork.systems.datadog.DatadogDomainConverter;
import com.expedia.pitchfork.systems.datadog.model.DatadogSpan;
import com.expedia.pitchfork.systems.datadog.forwarder.properties.DatadogForwarderConfigProperties;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.model.DatadogSpan;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.properties.DatadogForwarderConfigProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.client;
package com.expedia.pitchfork.systems.datadog.forwarder.client;

import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.properties.DatadogForwarderConfigProperties;
import com.expedia.pitchfork.systems.datadog.forwarder.properties.DatadogForwarderConfigProperties;
import io.netty.handler.timeout.ReadTimeoutHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.properties;
package com.expedia.pitchfork.systems.datadog.forwarder.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.hotels.service.tracing.zipkintohaystack.ingresses.datadog;
package com.expedia.pitchfork.systems.datadog.ingress;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.DatadogDomainConverter;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.model.DatadogSpan;
import com.hotels.service.tracing.zipkintohaystack.forwarders.zipkin.http.ZipkinForwarder;
import com.hotels.service.tracing.zipkintohaystack.ingresses.Decoder;
import com.expedia.pitchfork.systems.datadog.DatadogDomainConverter;
import com.expedia.pitchfork.systems.datadog.model.DatadogSpan;
import com.expedia.pitchfork.systems.zipkin.forwarder.ZipkinForwarder;
import com.expedia.pitchfork.systems.common.IngressDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand All @@ -19,7 +19,7 @@
import static java.util.stream.Collectors.toList;

@Component
public class DatadogSpansJsonDecoder implements Decoder {
public class DatadogSpansJsonDecoder implements IngressDecoder {

private static final Logger logger = LoggerFactory.getLogger(ZipkinForwarder.class);
private final ObjectReader reader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.hotels.service.tracing.zipkintohaystack.ingresses.datadog;
package com.expedia.pitchfork.systems.datadog.ingress;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.DatadogDomainConverter;
import com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.model.DatadogSpan;
import com.hotels.service.tracing.zipkintohaystack.forwarders.zipkin.http.ZipkinForwarder;
import com.hotels.service.tracing.zipkintohaystack.ingresses.Decoder;
import com.expedia.pitchfork.systems.datadog.DatadogDomainConverter;
import com.expedia.pitchfork.systems.datadog.model.DatadogSpan;
import com.expedia.pitchfork.systems.zipkin.forwarder.ZipkinForwarder;
import com.expedia.pitchfork.systems.common.IngressDecoder;
import org.msgpack.jackson.dataformat.MessagePackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -21,7 +21,7 @@
import static java.util.stream.Collectors.toList;

@Component
public class DatadogSpansMessagePackDecoder implements Decoder {
public class DatadogSpansMessagePackDecoder implements IngressDecoder {

private static final Logger logger = LoggerFactory.getLogger(ZipkinForwarder.class);
private ObjectReader reader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hotels.service.tracing.zipkintohaystack.forwarders.datadog.model;
package com.expedia.pitchfork.systems.datadog.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack;
package com.expedia.pitchfork.systems.haystack;

import com.expedia.open.tracing.Log;
import com.expedia.open.tracing.Span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack;
package com.expedia.pitchfork.systems.haystack;

import javax.annotation.PostConstruct;

import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import io.micrometer.core.instrument.Counter;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kafka;
package com.expedia.pitchfork.systems.haystack.forwarder.kafka;

import com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kafka.properties.KafkaForwarderConfigProperties;
import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import com.expedia.pitchfork.systems.haystack.forwarder.kafka.properties.KafkaForwarderConfigProperties;
import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics;
import org.apache.kafka.clients.producer.KafkaProducer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kafka;
package com.expedia.pitchfork.systems.haystack.forwarder.kafka;

import com.expedia.open.tracing.Span;
import com.hotels.service.tracing.zipkintohaystack.forwarders.SpanForwarder;
import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import com.expedia.pitchfork.systems.common.SpanForwarder;
import com.expedia.pitchfork.systems.haystack.HaystackDomainConverter;
import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import io.micrometer.core.instrument.Counter;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.HaystackDomainConverter.fromZipkinV2;

/**
* Implementation of a {@link SpanForwarder} that accepts a span in {@code Zipkin} format, converts to Haystack domain and pushes a {@code Kafka} stream.
*/
Expand All @@ -51,7 +50,7 @@ public void process(zipkin2.Span input) {
logger.debug("operation=process, span={}", input);

try {
Span span = fromZipkinV2(input);
Span span = HaystackDomainConverter.fromZipkinV2(input);
byte[] value = span.toByteArray();

final ProducerRecord<String, byte[]> record = new ProducerRecord<>(topic, span.getTraceId(), value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kafka.properties;
package com.expedia.pitchfork.systems.haystack.forwarder.kafka.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis;

import com.amazonaws.services.kinesis.AmazonKinesis;
import com.expedia.open.tracing.Span;
import com.hotels.service.tracing.zipkintohaystack.forwarders.SpanForwarder;
import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import com.expedia.pitchfork.systems.common.SpanForwarder;
import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import io.micrometer.core.instrument.Counter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;

import static com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.HaystackDomainConverter.fromZipkinV2;
import static com.expedia.pitchfork.systems.haystack.HaystackDomainConverter.fromZipkinV2;

/**
* Implementation of a {@link SpanForwarder} that accepts a span in {@code Zipkin} format,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
Expand All @@ -23,10 +23,10 @@
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.kinesis.AmazonKinesis;
import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder;
import com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties.AuthConfigProperties;
import com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties.ClientConfigProperties;
import com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties.KinesisForwarderConfigProperties;
import com.hotels.service.tracing.zipkintohaystack.metrics.MetersProvider;
import com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties.AuthConfigProperties;
import com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties.ClientConfigProperties;
import com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties.KinesisForwarderConfigProperties;
import com.expedia.pitchfork.monitoring.metrics.MetersProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties;

public class AuthConfigProperties {
private AwsAuthenticationTypeEnum configType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties;

public enum AwsAuthenticationTypeEnum {
DEFAULT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties;

public class BasicAuthConfigProperties {
private String awsAccessKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
package com.hotels.service.tracing.zipkintohaystack.forwarders.haystack.kinesis.properties;
package com.expedia.pitchfork.systems.haystack.forwarder.kinesis.properties;

public class ClientConfigProperties {
private ClientConfigurationEnum configType;
Expand Down
Loading

0 comments on commit 801be7f

Please sign in to comment.