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

routing: avoid allocating new entry in EndpointRegistry.GetMetrics #2847

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

AlexanderYastrebov
Copy link
Member

EndpointRegistry.GetMetrics always allocates new entry even when data for the key already exists.

sync.Map does not provide lazy initialization for the new value, see golang/go#44159

This change uses suggested best-effort to avoid allocating a new value on each load.

Follow up on #2795

@AlexanderYastrebov AlexanderYastrebov added the minor no risk changes, for example new filters label Jan 12, 2024
EndpointRegistry.GetMetrics always allocates new entry even when
data for the key already exists.

sync.Map does not provide lazy initialization for the new value,
see golang/go#44159

This change uses suggested best-effort to avoid allocating
a new value on each load.

Follow up on #2795

Signed-off-by: Alexander Yastrebov <[email protected]>
@AlexanderYastrebov AlexanderYastrebov force-pushed the routing/avoid-entry-alloc branch from 1c5d7c0 to e0ec88e Compare January 12, 2024 13:15
@RomanZavodskikh
Copy link
Contributor

👍

1 similar comment
@szuecs
Copy link
Member

szuecs commented Jan 12, 2024

👍

@szuecs szuecs merged commit d238294 into master Jan 12, 2024
14 checks passed
@szuecs szuecs deleted the routing/avoid-entry-alloc branch January 12, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor no risk changes, for example new filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants