mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 02:28:06 +01:00
enable OTLP export
This commit is contained in:
committed by
GitHub
parent
4f0337021c
commit
8aa408a3c1
@@ -13,6 +13,8 @@ import java.time.Duration;
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = DogstatsdConfiguration.class)
|
||||
public interface DatadogConfiguration extends StatsdConfig, Discoverable {
|
||||
|
||||
boolean enabled();
|
||||
|
||||
String getEnvironment();
|
||||
|
||||
Duration getShutdownWaitDuration();
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.time.Duration;
|
||||
@JsonTypeName("default")
|
||||
public class DogstatsdConfiguration implements DatadogConfiguration {
|
||||
|
||||
@JsonProperty
|
||||
private boolean enabled = true;
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private Duration step = Duration.ofSeconds(10);
|
||||
@@ -27,6 +30,11 @@ public class DogstatsdConfiguration implements DatadogConfiguration {
|
||||
@NotBlank
|
||||
private String host;
|
||||
|
||||
@Override
|
||||
public boolean enabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration step() {
|
||||
return step;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2025 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micrometer.registry.otlp.OtlpConfig;
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
|
||||
public record OpenTelemetryConfiguration(
|
||||
@JsonProperty boolean enabled,
|
||||
@JsonProperty Duration shutdownWaitDuration,
|
||||
@JsonAnyGetter @JsonAnySetter Map<String, String> otlpConfig
|
||||
) implements OtlpConfig {
|
||||
|
||||
@Override
|
||||
public String get(String key) {
|
||||
return otlpConfig.get(key.split("\\.", 2)[1]);
|
||||
}
|
||||
|
||||
public Duration shutdownWaitDuration() {
|
||||
if (shutdownWaitDuration == null) {
|
||||
return step().plus(step().dividedBy(2));
|
||||
}
|
||||
return shutdownWaitDuration;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user