mirror of
https://github.com/signalapp/Signal-Server
synced 2026-02-28 20:54:40 +00:00
Add the Wavefront/Micrometer reporter as a dependency and configure a registry.
This commit is contained in:
committed by
Jon Chambers
parent
7da9e88c0b
commit
45ad8f8ffb
@@ -58,6 +58,11 @@ public class WhisperServerConfiguration extends Configuration {
|
||||
@JsonProperty
|
||||
private CdnConfiguration cdn;
|
||||
|
||||
@NotNull
|
||||
@Valid
|
||||
@JsonProperty
|
||||
private MicrometerConfiguration micrometer;
|
||||
|
||||
@NotNull
|
||||
@Valid
|
||||
@JsonProperty
|
||||
@@ -272,6 +277,10 @@ public class WhisperServerConfiguration extends Configuration {
|
||||
return cdn;
|
||||
}
|
||||
|
||||
public MicrometerConfiguration getMicrometerConfiguration() {
|
||||
return micrometer;
|
||||
}
|
||||
|
||||
public UnidentifiedDeliveryConfiguration getDeliveryCertificate() {
|
||||
return unidentifiedDelivery;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ import io.dropwizard.db.PooledDataSourceFactory;
|
||||
import io.dropwizard.jdbi3.JdbiFactory;
|
||||
import io.dropwizard.setup.Bootstrap;
|
||||
import io.dropwizard.setup.Environment;
|
||||
import io.micrometer.core.instrument.Clock;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import io.micrometer.wavefront.WavefrontMeterRegistry;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.eclipse.jetty.servlets.CrossOriginFilter;
|
||||
import org.jdbi.v3.core.Jdbi;
|
||||
@@ -194,6 +197,8 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||
throws Exception
|
||||
{
|
||||
SharedMetricRegistries.add(Constants.METRICS_NAME, environment.metrics());
|
||||
Metrics.addRegistry(new WavefrontMeterRegistry(config.getMicrometerConfiguration(), Clock.SYSTEM));
|
||||
|
||||
environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
environment.getObjectMapper().setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
|
||||
environment.getObjectMapper().setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.whispersystems.textsecuregcm.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.micrometer.wavefront.WavefrontConfig;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
public class MicrometerConfiguration implements WavefrontConfig {
|
||||
|
||||
@JsonProperty
|
||||
@NotEmpty
|
||||
private String uri;
|
||||
|
||||
@JsonProperty
|
||||
@NotEmpty
|
||||
private String apiToken;
|
||||
|
||||
@Override
|
||||
public String get(final String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiToken() {
|
||||
return apiToken;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user