Add the Wavefront/Micrometer reporter as a dependency and configure a registry.
This commit is contained in:
parent
7da9e88c0b
commit
45ad8f8ffb
|
@ -91,3 +91,7 @@ apn: # Apple Push Notifications configuration
|
||||||
gcm: # GCM Configuration
|
gcm: # GCM Configuration
|
||||||
senderId:
|
senderId:
|
||||||
apiKey:
|
apiKey:
|
||||||
|
|
||||||
|
micrometer: # Micrometer metrics config
|
||||||
|
uri: "https://metrics.example.com/"
|
||||||
|
apiToken:
|
||||||
|
|
|
@ -74,6 +74,11 @@
|
||||||
<version>${resilience4j.version}</version>
|
<version>${resilience4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.micrometer</groupId>
|
||||||
|
<artifactId>micrometer-registry-wavefront</artifactId>
|
||||||
|
<version>1.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.amazonaws</groupId>
|
<groupId>com.amazonaws</groupId>
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class WhisperServerConfiguration extends Configuration {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private CdnConfiguration cdn;
|
private CdnConfiguration cdn;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Valid
|
||||||
|
@JsonProperty
|
||||||
|
private MicrometerConfiguration micrometer;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Valid
|
@Valid
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@ -272,6 +277,10 @@ public class WhisperServerConfiguration extends Configuration {
|
||||||
return cdn;
|
return cdn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MicrometerConfiguration getMicrometerConfiguration() {
|
||||||
|
return micrometer;
|
||||||
|
}
|
||||||
|
|
||||||
public UnidentifiedDeliveryConfiguration getDeliveryCertificate() {
|
public UnidentifiedDeliveryConfiguration getDeliveryCertificate() {
|
||||||
return unidentifiedDelivery;
|
return unidentifiedDelivery;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ import io.dropwizard.db.PooledDataSourceFactory;
|
||||||
import io.dropwizard.jdbi3.JdbiFactory;
|
import io.dropwizard.jdbi3.JdbiFactory;
|
||||||
import io.dropwizard.setup.Bootstrap;
|
import io.dropwizard.setup.Bootstrap;
|
||||||
import io.dropwizard.setup.Environment;
|
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.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
import org.eclipse.jetty.servlets.CrossOriginFilter;
|
import org.eclipse.jetty.servlets.CrossOriginFilter;
|
||||||
import org.jdbi.v3.core.Jdbi;
|
import org.jdbi.v3.core.Jdbi;
|
||||||
|
@ -194,6 +197,8 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
SharedMetricRegistries.add(Constants.METRICS_NAME, environment.metrics());
|
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().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
environment.getObjectMapper().setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
|
environment.getObjectMapper().setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
|
||||||
environment.getObjectMapper().setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue