-
Notifications
You must be signed in to change notification settings - Fork 879
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
Disable by default gauge-based histograms in the Micrometer bridge #8360
Merged
mateuszrzeszutek
merged 2 commits into
open-telemetry:main
from
mateuszrzeszutek:disable-histogram-gauges-by-default
May 15, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Settings for the Micrometer bridge instrumentation | ||
|
||
| System property | Type | Default | Description | | ||
|---|---|---|---| | ||
| `otel.instrumentation.micrometer.base-time-unit` | String | `ms` | Set the base time unit for the OpenTelemetry `MeterRegistry` implementation. <details><summary>Valid values</summary>`ns`, `nanoseconds`, `us`, `microseconds`, `ms`, `microseconds`, `s`, `seconds`, `min`, `minutes`, `h`, `hours`, `d`, `days`</details> | | ||
| `otel.instrumentation.micrometer.prometheus-mode.enabled` | boolean | false | Enable the "Prometheus mode" this will simulate the behavior of Micrometer's PrometheusMeterRegistry. The instruments will be renamed to match Micrometer instrument naming, and the base time unit will be set to seconds. | | ||
| System property | Type | Default | Description | | ||
|------------------------------------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `otel.instrumentation.micrometer.base-time-unit` | String | `ms` | Set the base time unit for the OpenTelemetry `MeterRegistry` implementation. <details><summary>Valid values</summary>`ns`, `nanoseconds`, `us`, `microseconds`, `ms`, `microseconds`, `s`, `seconds`, `min`, `minutes`, `h`, `hours`, `d`, `days`</details> | | ||
| `otel.instrumentation.micrometer.prometheus-mode.enabled` | boolean | false | Enable the "Prometheus mode" this will simulate the behavior of Micrometer's PrometheusMeterRegistry. The instruments will be renamed to match Micrometer instrument naming, and the base time unit will be set to seconds. | | ||
| `otel.instrumentation.micrometer.histogram-gauges.enabled` | boolean | false | Enables the generation of gauge-based Micrometer histograms for `DistributionSummary` and `Timer` instruments. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...try/javaagent/instrumentation/micrometer/v1_5/DistributionSummaryHistogramGaugesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.micrometer.v1_5; | ||
|
||
import io.micrometer.core.instrument.Metrics; | ||
import io.opentelemetry.instrumentation.micrometer.v1_5.AbstractDistributionSummaryHistogramGaugesTest; | ||
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class DistributionSummaryHistogramGaugesTest | ||
extends AbstractDistributionSummaryHistogramGaugesTest { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); | ||
|
||
@AfterEach | ||
public void cleanup() { | ||
Metrics.globalRegistry.forEachMeter(Metrics.globalRegistry::remove); | ||
} | ||
|
||
@Override | ||
protected InstrumentationExtension testing() { | ||
return testing; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/TimerHistogramGaugesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.micrometer.v1_5; | ||
|
||
import io.micrometer.core.instrument.Metrics; | ||
import io.opentelemetry.instrumentation.micrometer.v1_5.AbstractTimerHistogramGaugesTest; | ||
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class TimerHistogramGaugesTest extends AbstractTimerHistogramGaugesTest { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); | ||
|
||
@AfterEach | ||
public void cleanup() { | ||
Metrics.globalRegistry.forEachMeter(Metrics.globalRegistry::remove); | ||
} | ||
|
||
@Override | ||
protected InstrumentationExtension testing() { | ||
return testing; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...io/opentelemetry/instrumentation/micrometer/v1_5/DistributionStatisticConfigModifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.micrometer.v1_5; | ||
|
||
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; | ||
|
||
@SuppressWarnings("CanIgnoreReturnValueSuggester") | ||
enum DistributionStatisticConfigModifier { | ||
DISABLE_HISTOGRAM_GAUGES { | ||
@Override | ||
DistributionStatisticConfig modify(DistributionStatisticConfig config) { | ||
return DistributionStatisticConfig.builder() | ||
// disable all percentile and slo related options | ||
.percentilesHistogram(null) | ||
.percentiles((double[]) null) | ||
.serviceLevelObjectives((double[]) null) | ||
.percentilePrecision(null) | ||
// and keep the rest | ||
.minimumExpectedValue(config.getMinimumExpectedValueAsDouble()) | ||
.maximumExpectedValue(config.getMaximumExpectedValueAsDouble()) | ||
.expiry(config.getExpiry()) | ||
.bufferLength(config.getBufferLength()) | ||
.build(); | ||
} | ||
}, | ||
IDENTITY { | ||
@Override | ||
DistributionStatisticConfig modify(DistributionStatisticConfig config) { | ||
return config; | ||
} | ||
}; | ||
|
||
abstract DistributionStatisticConfig modify(DistributionStatisticConfig config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...opentelemetry/instrumentation/micrometer/v1_5/DistributionSummaryHistogramGaugesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.micrometer.v1_5; | ||
|
||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class DistributionSummaryHistogramGaugesTest | ||
extends AbstractDistributionSummaryHistogramGaugesTest { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create(); | ||
|
||
@RegisterExtension | ||
static final MicrometerTestingExtension micrometerExtension = | ||
new MicrometerTestingExtension(testing) { | ||
@Override | ||
OpenTelemetryMeterRegistryBuilder configureOtelRegistry( | ||
OpenTelemetryMeterRegistryBuilder registry) { | ||
return registry.setMicrometerHistogramGaugesEnabled(true); | ||
} | ||
}; | ||
|
||
@Override | ||
protected InstrumentationExtension testing() { | ||
return testing; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../test/java/io/opentelemetry/instrumentation/micrometer/v1_5/TimerHistogramGaugesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.micrometer.v1_5; | ||
|
||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; | ||
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class TimerHistogramGaugesTest extends AbstractTimerHistogramGaugesTest { | ||
|
||
@RegisterExtension | ||
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create(); | ||
|
||
@RegisterExtension | ||
static final MicrometerTestingExtension micrometerExtension = | ||
new MicrometerTestingExtension(testing) { | ||
@Override | ||
OpenTelemetryMeterRegistryBuilder configureOtelRegistry( | ||
OpenTelemetryMeterRegistryBuilder registry) { | ||
return registry.setMicrometerHistogramGaugesEnabled(true); | ||
} | ||
}; | ||
|
||
@Override | ||
protected InstrumentationExtension testing() { | ||
return testing; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to change the default to
s
(in the same release as #8435)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely! I've been waiting for the other two micrometer PRs to get merged first though, because of a large number of conflicts (especially in test code)