-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add meter provider configurer to change observable up down counter to… #89
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0df22ab
Add meter provider configurer to change observable up down counter to…
jack-berg 7ec0ddf
Update sdk config to aggregate observable up down counter as gauge
jack-berg 48512ac
Upgrade to 1.11.0
jack-berg 39c7e42
Use extension instead of initializer
jack-berg 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
27 changes: 27 additions & 0 deletions
27
...otel-initializer/src/main/java/com/newrelic/otel/initializer/MeterProviderCustomizer.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,27 @@ | ||
package com.newrelic.otel.initializer; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; | ||
import io.opentelemetry.sdk.autoconfigure.spi.metrics.SdkMeterProviderConfigurer; | ||
import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; | ||
import io.opentelemetry.sdk.metrics.common.InstrumentType; | ||
import io.opentelemetry.sdk.metrics.view.Aggregation; | ||
import io.opentelemetry.sdk.metrics.view.InstrumentSelector; | ||
import io.opentelemetry.sdk.metrics.view.View; | ||
|
||
/** | ||
* Note this class is wired into SPI via {@code | ||
* resources/META-INF/services/com.newrelic.otel.initializer.SdkMeterProviderConfigurer} | ||
*/ | ||
public class MeterProviderCustomizer implements SdkMeterProviderConfigurer { | ||
|
||
@Override | ||
public void configure(SdkMeterProviderBuilder meterProviderBuilder, ConfigProperties config) { | ||
// Aggregate OBSERVABLE_UP_DOWN_SUM as gauge instead of sum. This allows OBSERVABLE_UP_DOWN_SUM | ||
// data to still be useful when aggregation temporality is set to DELTA. | ||
meterProviderBuilder.registerView( | ||
InstrumentSelector.builder() | ||
.setInstrumentType(InstrumentType.OBSERVABLE_UP_DOWN_SUM) | ||
.build(), | ||
View.builder().setAggregation(Aggregation.lastValue()).build()); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...TA-INF/services/io.opentelemetry.sdk.autoconfigure.spi.metrics.SdkMeterProviderConfigurer
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 @@ | ||
com.newrelic.otel.initializer.MeterProviderCustomizer |
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
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.
We probably want to demonstrate changing the aggregation to last value for
InstrumentType.UP_DOWN_COUNTER
since those will be equally unusable as deltas.... Also is it
OBSERVABLE_UP_DOWN_SUM
orOBSERVABLE_UP_DOWN_COUNTER
?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.
Last value doesn't help for sync up down counter because we would just get the last incremental recording. I.e. +1 or -1 or something liek that.
Its both. We recently deprecated
OBSERVABLE_UP_DOWN_SUM
in favor ofOBSERVABLE_UP_DOWN_COUNTER
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.
I promise, you'll only have to say this 16 more times.