Retire now-unused HTTP transport configuration for Datadog metric reporter
This commit is contained in:
parent
ed0a723fef
commit
7f37c8ee5e
|
@ -22,8 +22,6 @@ metrics:
|
|||
tags:
|
||||
- "env:staging"
|
||||
- "service:chat"
|
||||
transport:
|
||||
apiKey: secret://datadog.apiKey
|
||||
udpTransport:
|
||||
statsdHost: localhost
|
||||
port: 8125
|
||||
|
|
|
@ -15,11 +15,9 @@ import com.codahale.metrics.ScheduledReporter;
|
|||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.dropwizard.metrics.BaseReporterFactory;
|
||||
import io.dropwizard.util.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
@ -28,11 +26,8 @@ import org.coursera.metrics.datadog.DatadogReporter.Expansion;
|
|||
import org.coursera.metrics.datadog.DefaultMetricNameFormatterFactory;
|
||||
import org.coursera.metrics.datadog.DynamicTagsCallbackFactory;
|
||||
import org.coursera.metrics.datadog.MetricNameFormatterFactory;
|
||||
import org.coursera.metrics.datadog.transport.HttpTransport;
|
||||
import org.coursera.metrics.datadog.transport.Transport;
|
||||
import org.coursera.metrics.datadog.transport.UdpTransport;
|
||||
import org.whispersystems.textsecuregcm.WhisperServerVersion;
|
||||
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
|
||||
import org.whispersystems.textsecuregcm.util.HostnameUtil;
|
||||
|
||||
@JsonTypeName("signal-datadog")
|
||||
|
@ -53,11 +48,6 @@ public class SignalDatadogReporterFactory extends BaseReporterFactory {
|
|||
@JsonProperty
|
||||
private MetricNameFormatterFactory metricNameFormatter = new DefaultMetricNameFormatterFactory();
|
||||
|
||||
@Valid
|
||||
@NotNull
|
||||
@JsonProperty("transport")
|
||||
private HttpTransportConfig httpTransportConfig;
|
||||
|
||||
@Valid
|
||||
@NotNull
|
||||
@JsonProperty("udpTransport")
|
||||
|
@ -89,12 +79,8 @@ public class SignalDatadogReporterFactory extends BaseReporterFactory {
|
|||
}
|
||||
}
|
||||
|
||||
final boolean useUdpTransport = Optional.ofNullable(System.getenv("SIGNAL_USE_DATADOG_UDP_TRANSPORT")).isPresent();
|
||||
final Transport transport =
|
||||
useUdpTransport ? udpTransportConfig.udpTransport() : httpTransportConfig.httpTransport();
|
||||
|
||||
return DatadogReporter.forRegistry(registry)
|
||||
.withTransport(transport)
|
||||
.withTransport(udpTransportConfig.udpTransport())
|
||||
.withHost(HostnameUtil.getLocalHostname())
|
||||
.withTags(tagsWithVersion)
|
||||
.withPrefix(prefix)
|
||||
|
@ -107,28 +93,6 @@ public class SignalDatadogReporterFactory extends BaseReporterFactory {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static class HttpTransportConfig {
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private SecretString apiKey;
|
||||
|
||||
@JsonProperty
|
||||
private Duration connectTimeout = Duration.seconds(5);
|
||||
|
||||
@JsonProperty
|
||||
private Duration socketTimeout = Duration.seconds(5);
|
||||
|
||||
|
||||
public HttpTransport httpTransport() {
|
||||
return new HttpTransport.Builder()
|
||||
.withApiKey(apiKey.value())
|
||||
.withConnectTimeout((int) connectTimeout.toMilliseconds())
|
||||
.withSocketTimeout((int) socketTimeout.toMilliseconds())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
public record UdpTransportConfig(@NotNull String statsdHost, @Min(1) int port) {
|
||||
|
||||
public UdpTransport udpTransport() {
|
||||
|
|
Loading…
Reference in New Issue