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

Add span names cache #4004

Merged
merged 2 commits into from
Aug 30, 2021
Merged

Add span names cache #4004

merged 2 commits into from
Aug 30, 2021

Conversation

trask
Copy link
Member

@trask trask commented Aug 28, 2021

No description provided.

@trask trask marked this pull request as ready for review August 29, 2021 02:47
import java.lang.reflect.Method;
import org.checkerframework.checker.nullness.qual.Nullable;

public final class SpanNames {

private static final ClassValue<Cache<String, String>> spanNameCaches =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check whether instrumentation have their own cache to not double cache?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, just looked through all callers, didn't find any secondary caches

new ClassValue<Cache<String, String>>() {
@Override
protected Cache<String, String> computeValue(Class<?> clazz) {
// should be naturally bounded, but setting a limit just in case
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty safe to me I'd probably just use ConcurrentHashMap. I think I've seen us using it in other similar caches

@trask trask merged commit dc4e239 into open-telemetry:main Aug 30, 2021
@trask trask deleted the span-names-cache branch August 30, 2021 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants