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

Make Advice proper immutable class #5532

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package io.opentelemetry.sdk.metrics.internal.descriptor;

import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
Expand All @@ -20,7 +22,17 @@ public static Advice empty() {
return EMPTY_ADVICE;
}

/**
* Creates a new {@link Advice} with the given explicit bucket histogram boundaries.
*
* @param explicitBucketBoundaries the explicit bucket histogram boundaries.
* @return a new {@link Advice} with the given bucket boundaries.
*/
public static Advice create(@Nullable List<Double> explicitBucketBoundaries) {
if (explicitBucketBoundaries != null) {
explicitBucketBoundaries =
Collections.unmodifiableList(new ArrayList<>(explicitBucketBoundaries));
}
return new AutoValue_Advice(explicitBucketBoundaries);
}

Expand Down