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

[1.2.x] Fix concurrent issue in observability #42962

Conversation

NipunaMadhushan
Copy link
Contributor

Purpose

Due to high throughput of inprogress requests, we have been notified that the http_inprogress_requests_value metric value is higher than the expected value.

There is a observer context list (HashMap) which contains the observer contexts with span IDs as keys. since it is updated with multiple threads concurrently, it resulted in incorrect calculations of new array sizes, including negative sizes for the HashMap.

Therefore HashMap has been replaced with ConcurrentHashMap which is a thread-safe implementation. With this approach, multiple threads can access it simultaneously without any synchronization issues.

Fixes https://github.com/wso2-enterprise/internal-support-ballerina/issues/679

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@NipunaMadhushan NipunaMadhushan changed the title Fix concurrent issue in observability [1.2.x] Fix concurrent issue in observability Jun 20, 2024
@warunalakshitha
Copy link
Contributor

Can we add test cases for these cases?

@NipunaMadhushan
Copy link
Contributor Author

NipunaMadhushan commented Jun 24, 2024

Can we add test cases for these cases?

Since these scenarios came only with high throughput in MG, I really doubt if it is possible as a Java test case.

Copy link
Contributor

@warunalakshitha warunalakshitha left a comment

Choose a reason for hiding this comment

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

LGTM

@keizer619 keizer619 merged commit 046c47a into ballerina-platform:ballerina-1.2.x Jun 26, 2024
7 checks passed
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.

4 participants