Skip to content

Commit

Permalink
Improve docs for Wavefront Application Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
oppegard committed Nov 2, 2022
1 parent 2646469 commit 1f43002
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Expand Up @@ -77,7 +77,6 @@ public WavefrontMeterRegistry wavefrontMeterRegistry(WavefrontConfig wavefrontCo

@Bean
@ConditionalOnBean(ApplicationTags.class)
@ConditionalOnClass(MeterRegistryCustomizer.class)
MeterRegistryCustomizer<WavefrontMeterRegistry> applicationTagsCustomizer(ApplicationTags applicationTags) {
Tags commonTags = Tags.of(applicationTags.toPointTags().entrySet().stream()
.map(WavefrontMetricsExportAutoConfiguration::asTag).toList());
Expand Down
Expand Up @@ -59,22 +59,27 @@
@ConditionalOnEnabledTracing
public class WavefrontTracingAutoConfiguration {

private static final String DEFAULT_APPLICATION_NAME = "unnamed_application";
/**
* Default value for the Wavefront Application name.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private static final String DEFAULT_WAVEFRONT_APPLICATION_NAME = "unnamed_application";

/**
* Default value for service name if {@code spring.application.name} is not set.
* Default value for the Wavefront Service name if {@code spring.application.name} is not set.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private static final String DEFAULT_SERVICE_NAME = "unnamed_service";
private static final String DEFAULT_WAVEFRONT_SERVICE_NAME = "unnamed_service";

@Bean
@ConditionalOnMissingBean
public ApplicationTags applicationTags(Environment environment, WavefrontProperties properties) {
String fallbackServiceName = environment.getProperty("spring.application.name", DEFAULT_SERVICE_NAME);
String fallbackWavefrontServiceName = environment.getProperty("spring.application.name", DEFAULT_WAVEFRONT_SERVICE_NAME);
Tracing tracing = properties.getTracing();
String serviceName = (tracing.getServiceName() != null) ? tracing.getServiceName() : fallbackServiceName;
String applicationName = (tracing.getApplicationName() != null) ? tracing.getApplicationName()
: DEFAULT_APPLICATION_NAME;
ApplicationTags.Builder builder = new ApplicationTags.Builder(applicationName, serviceName);
String wavefrontServiceName = (tracing.getServiceName() != null) ? tracing.getServiceName() : fallbackWavefrontServiceName;
String wavefrontApplicationName = (tracing.getApplicationName() != null) ? tracing.getApplicationName()
: DEFAULT_WAVEFRONT_APPLICATION_NAME;
ApplicationTags.Builder builder = new ApplicationTags.Builder(wavefrontApplicationName, wavefrontServiceName);
if (tracing.getClusterName() != null) {
builder.cluster(tracing.getClusterName());
}
Expand Down
Expand Up @@ -264,25 +264,29 @@ public void setBatchSize(Integer batchSize) {
public static class Tracing {

/**
* Application name used in {@link ApplicationTags}. Defaults to
* Wavefront Application name used in {@link ApplicationTags}. Defaults to
* 'unnamed_application'.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private String applicationName;

/**
* Service name used in {@link ApplicationTags}, falling back to
* Wavefront Service name used in {@link ApplicationTags}, falling back to
* {@code spring.application.name}. If both are unset it defaults to
* 'unnamed_service'.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private String serviceName;

/**
* Optional cluster name used in {@link ApplicationTags}.
* Optional Wavefront Cluster name used in {@link ApplicationTags}.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private String clusterName;

/**
* Optional shard name used in {@link ApplicationTags}.
* Optional Wavefront Shard name used in {@link ApplicationTags}.
* @see <a href="https://docs.wavefront.com/trace_data_details.html#application-tags">Wavefront Application Tags</a>
*/
private String shardName;

Expand Down

0 comments on commit 1f43002

Please sign in to comment.