com.nike.wingtips.springboot.WingtipsZipkinProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wingtips-zipkin-spring-boot Show documentation
Show all versions of wingtips-zipkin-spring-boot Show documentation
Wingtips module wingtips-zipkin-spring-boot
package com.nike.wingtips.springboot;
import com.nike.wingtips.Span.SpanPurpose;
import com.nike.wingtips.zipkin.WingtipsToZipkinLifecycleListener;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* A {@link ConfigurationProperties} companion for {@link WingtipsWithZipkinSpringBootConfiguration} that allows you to
* specify the configuration of {@link WingtipsToZipkinLifecycleListener} via your Spring Boot application's properties
* files. The following properties are supported (NOTE: {@code wingtips.zipkin.base-url} is required - all others are
* optional and can be left out):
*
* -
* wingtips.zipkin.zipkin-disabled - Disables registering {@link WingtipsToZipkinLifecycleListener} with
* Wingtips if and only if this property value is set to true. If false or missing then {@link
* WingtipsToZipkinLifecycleListener} will be registered normally.
*
* -
* wingtips.zipkin.base-url - (REQUIRED) The base URL of the Zipkin server to send Wingtips spans to.
* See the Zipkin server quickstart page for info on how to
* easily setup a local Zipkin server for testing (can be done with a single docker command).
*
* -
* wingtips.zipkin.service-name - The name of this service, used when sending Wingtips spans to Zipkin. See
* the {@link WingtipsToZipkinLifecycleListener#WingtipsToZipkinLifecycleListener(String, String, String)}
* constructor javadocs or the
* wingtips-zipkin readme
* for details on how this service name is used. If you don't set this property then {@code "unknown"} will be
* used.
*
* -
* wingtips.zipkin.local-component-namespace - The Zipkin local component namespace for local-only spans, used
* when sending {@link SpanPurpose#LOCAL_ONLY} Wingtips spans to Zipkin. See
* the {@link WingtipsToZipkinLifecycleListener#WingtipsToZipkinLifecycleListener(String, String, String)}
* constructor javadocs or the
* wingtips-zipkin readme for
* details on how this local component namespace is used. If you don't set this property then {@code "unknown"}
* will be used.
*
*
*
* For example you could set the following properties in your {@code application.properties}:
*
* wingtips.zipkin.zipkin-disabled=false
* wingtips.zipkin.base-url=http://localhost:9411
* wingtips.zipkin.service-name=some-service-name
* wingtips.zipkin.local-component-namespace=some-local-component-name
*
*
* @author Ales Justin
*/
@ConfigurationProperties("wingtips.zipkin")
@SuppressWarnings("WeakerAccess")
public class WingtipsZipkinProperties {
private boolean zipkinDisabled = false;
private String serviceName = "unknown";
private String localComponentNamespace = "unknown";
private String baseUrl;
public boolean shouldApplyWingtipsToZipkinLifecycleListener() {
return (!zipkinDisabled && serviceName != null && localComponentNamespace != null && baseUrl != null);
}
public boolean isZipkinDisabled() {
return zipkinDisabled;
}
public void setZipkinDisabled(String zipkinDisabled) {
this.zipkinDisabled = "true".equalsIgnoreCase(zipkinDisabled);
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public String getLocalComponentNamespace() {
return localComponentNamespace;
}
public void setLocalComponentNamespace(String localComponentNamespace) {
this.localComponentNamespace = localComponentNamespace;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
}