Skip to content

Commit

Permalink
replaced Function<SpanData, String> with a custom CategoryFunction i…
Browse files Browse the repository at this point in the history
…nterface and Duration with a plain long value for timeWindowInMillis

 ref open-telemetry#638
  • Loading branch information
Victorsesan committed Nov 1, 2024
1 parent ffcdf3c commit 6493988
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
6 changes: 0 additions & 6 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
buildConfigField("String", "OTEL_ANDROID_VERSION", "\"$version\"")

// Enable desugaring for Java 8 features
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 // Set source compatibility to Java 8
targetCompatibility = JavaVersion.VERSION_1_8 // Set target compatibility to Java 8
}
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ private BandwidthThrottlingExporter(Builder builder) {
this.categoryFunction = builder.categoryFunction;
this.maxBytesPerSecond = builder.maxBytesPerSecond;
this.timeWindowInMillis = builder.timeWindow.toMillis();
this.lastExportTime = System.currentTimeMillis();

this.lastExportTime = SystemTime.get().getCurrentTimeMillis();
this.bytesExportedInWindow = 0;
}

Expand Down Expand Up @@ -88,9 +87,9 @@ public CompletableResultCode shutdown() {

static class Builder {
final SpanExporter delegate;
Function<SpanData, String> categoryFunction = span -> "default";
CategoryFunction categoryFunction = span -> "default";
long maxBytesPerSecond = 1024; // Default to 1 KB/s
Duration timeWindow = Duration.ofSeconds(1); // Default to 1 second
long timeWindowInMillis = 1000; // Default to 1 second

private Builder(SpanExporter delegate) {
this.delegate = delegate;
Expand Down

0 comments on commit 6493988

Please sign in to comment.