Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dynatrace v2] Update to utils library v2 #4064

Prev Previous commit
Next Next commit
fix: rename createMetadataBuilder() -> createMetadataStep()
  • Loading branch information
pichlermarc committed Sep 18, 2023
commit d772d10cfa0b422a8849651efa1bba4cd4eafc40
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private String createGaugeLine(Meter meter, Map<String, String> seenMetadata, Me
}
MetricLineBuilder.GaugeStep metricBuilder = createMetricBuilder(meter).gauge();
jonatan-ivanov marked this conversation as resolved.
Show resolved Hide resolved

storeMetadataLine(createMetadataBuilder(metricBuilder, meter), seenMetadata);
storeMetadataLine(createMetadataStep(metricBuilder, meter), seenMetadata);

return metricBuilder.value(value).timestamp(Instant.ofEpochMilli(clock.wallTime())).build();
}
Expand All @@ -244,7 +244,7 @@ private String createCounterLine(Meter meter, Map<String, String> seenMetadata,
try {
MetricLineBuilder.CounterStep metricBuilder = createMetricBuilder(meter).count();

storeMetadataLine(createMetadataBuilder(metricBuilder, meter), seenMetadata);
storeMetadataLine(createMetadataStep(metricBuilder, meter), seenMetadata);

return metricBuilder.delta(measurement.getValue())
.timestamp(Instant.ofEpochMilli(clock.wallTime()))
Expand Down Expand Up @@ -301,7 +301,7 @@ private Stream<String> createSummaryLine(Meter meter, Map<String, String> seenMe
try {
MetricLineBuilder.GaugeStep metricBuilder = createMetricBuilder(meter).gauge();

storeMetadataLine(createMetadataBuilder(metricBuilder, meter), seenMetadata);
storeMetadataLine(createMetadataStep(metricBuilder, meter), seenMetadata);

return Stream.of(metricBuilder.summary(min, max, total, count)
.timestamp(Instant.ofEpochMilli(clock.wallTime()))
Expand Down Expand Up @@ -466,13 +466,13 @@ private void handleSuccess(int totalSent, HttpSender.Response response) {
}
}

private MetricLineBuilder.MetadataStep createMetadataBuilder(MetricLineBuilder.GaugeStep metricBuilder,
Meter meter) {
private MetricLineBuilder.MetadataStep createMetadataStep(MetricLineBuilder.GaugeStep metricBuilder,
Meter meter) {
return enrichMetadataBuilder(metricBuilder.metadata(), meter);
}

private MetricLineBuilder.MetadataStep createMetadataBuilder(MetricLineBuilder.CounterStep metricBuilder,
Meter meter) {
private MetricLineBuilder.MetadataStep createMetadataStep(MetricLineBuilder.CounterStep metricBuilder,
Meter meter) {
return enrichMetadataBuilder(metricBuilder.metadata(), meter);
}

Expand All @@ -481,19 +481,19 @@ private MetricLineBuilder.MetadataStep enrichMetadataBuilder(MetricLineBuilder.M
return metadataBuilder.description(meter.getId().getDescription()).unit(meter.getId().getBaseUnit());
}

private void storeMetadataLine(MetricLineBuilder.MetadataStep metadataBuilder, Map<String, String> seenMetadata)
private void storeMetadataLine(MetricLineBuilder.MetadataStep metadataStep, Map<String, String> seenMetadata)
throws MetricException {
// if the config to export metadata is turned off, the seenMetadata map will be
// null.
if (seenMetadata == null) {
return;
}

if (metadataBuilder == null) {
if (metadataStep == null) {
return;
}

String metadataLine = metadataBuilder.build();
String metadataLine = metadataStep.build();

if (metadataLine == null){
return;
Expand Down