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

[APM UI] Latency distribution chart breaks due to transaction durations of value 0 #184256

Closed
neptunian opened this issue May 24, 2024 · 1 comment · Fixed by #191994
Closed
Assignees
Labels
apm:charts bug Fixes for quality problems that affect the customer experience good first issue low hanging fruit sdh-linked Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team

Comments

@neptunian
Copy link
Contributor

neptunian commented May 24, 2024

Summary

The latency distribution chart will not render if there are any documents where transaction.duration.histogram has a minimum or maximum value of 0.

This happens in the call to get_duration_histogram_range_steps and it responds with:

      "response": {
        "json": {
          "took": 12,
          "timed_out": false,
          "_shards": {
            "total": 48,
            "successful": 48,
            "skipped": 0,
            "failed": 0
          },
          "hits": {
            "total": {
              "value": 1,
              "relation": "gte"
            },
            "max_score": null,
            "hits": []
          },
          "aggregations": {
            "duration_max": {
              "value": 3817471
            },
            "duration_min": {
              "value": 0
            }
          }
        }
      }

Using the min and max values we call getHistogramRangeSteps. This purpose of this function is to generate a set of bins for histogram visualization, where the bins are distributed on a logarithmic scale, however logarithmic scales are undefined for zero and we don't handle this in the function. The array of zeros, then gets passed to another es query, get_duration_ranges, before it response with zero ranges. The result is it will return zeros to the UI and won't render anything.

Solution proposal

Transaction durations likely should never have values of 0, but in the event they do, we should still handle them. A solution would be to set the values to 1 if they are 0 in the function.

After some investigation, we verified that the values can be both 1 (the chart will still render) but they can't be 0.

AC

  • The latency distribution chart should render correctly
  • The duration min and max values should not be 0
@neptunian neptunian added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label May 24, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@smith smith added bug Fixes for quality problems that affect the customer experience apm:charts needs-refinement A reason and acceptance criteria need to be defined for this issue sdh-linked labels May 25, 2024
@smith smith added the good first issue low hanging fruit label Aug 13, 2024
@jennypavlova jennypavlova removed the needs-refinement A reason and acceptance criteria need to be defined for this issue label Sep 3, 2024
@jennypavlova jennypavlova removed their assignment Sep 3, 2024
rmyz added a commit that referenced this issue Sep 5, 2024
…ations of value 0 (#191994)

## Summary
Fixes: #184256

This PR fixes the APM latency distribution chart not being able to
render when we had any duration value as 0, to fix it, we now check if
it's 0 and override it with 1.

|Before|After|
|-|-|

|![image](https://github.com/user-attachments/assets/df224a1d-a669-4ea8-ad0e-9f81a82b904a)|![image](https://github.com/user-attachments/assets/cbf6957c-df6f-4f71-8f96-7985279912fa)|

## Test steps
1. Open the following file
`x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_histogram_range_steps.ts`
2. Modify L61 and L118 changing the initial two values passed to
`getHistogramRangeSteps` to 0.
Like `getHistogramRangeSteps(0, 0, steps)`.
It doesn't matter the order, if one of the params is at 0 it won't
render anything.
3. Revert the change and check if the chart is being rendered.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Sep 5, 2024
…ations of value 0 (elastic#191994)

## Summary
Fixes: elastic#184256

This PR fixes the APM latency distribution chart not being able to
render when we had any duration value as 0, to fix it, we now check if
it's 0 and override it with 1.

|Before|After|
|-|-|

|![image](https://github.com/user-attachments/assets/df224a1d-a669-4ea8-ad0e-9f81a82b904a)|![image](https://github.com/user-attachments/assets/cbf6957c-df6f-4f71-8f96-7985279912fa)|

## Test steps
1. Open the following file
`x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_histogram_range_steps.ts`
2. Modify L61 and L118 changing the initial two values passed to
`getHistogramRangeSteps` to 0.
Like `getHistogramRangeSteps(0, 0, steps)`.
It doesn't matter the order, if one of the params is at 0 it won't
render anything.
3. Revert the change and check if the chart is being rendered.

(cherry picked from commit 917473f)
kibanamachine referenced this issue Sep 5, 2024
…ion durations of value 0 (#191994) (#192165)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[APM UI] Fix Latency distribution chart breaks due to transaction
durations of value 0
(#191994)](#191994)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sergi
Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2024-09-05T10:35:29Z","message":"[APM
UI] Fix Latency distribution chart breaks due to transaction durations
of value 0 (#191994)\n\n## Summary\r\nFixes:
https://github.com/elastic/kibana/issues/184256\r\n\r\nThis PR fixes the
APM latency distribution chart not being able to\r\nrender when we had
any duration value as 0, to fix it, we now check if\r\nit's 0 and
override it with
1.\r\n\r\n|Before|After|\r\n|-|-|\r\n\r\n|![image](https://github.com/user-attachments/assets/df224a1d-a669-4ea8-ad0e-9f81a82b904a)|![image](https://github.com/user-attachments/assets/cbf6957c-df6f-4f71-8f96-7985279912fa)|\r\n\r\n##
Test steps\r\n1. Open the following
file\r\n`x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_histogram_range_steps.ts`\r\n2.
Modify L61 and L118 changing the initial two values passed
to\r\n`getHistogramRangeSteps` to 0.\r\nLike `getHistogramRangeSteps(0,
0, steps)`.\r\nIt doesn't matter the order, if one of the params is at 0
it won't\r\nrender anything.\r\n3. Revert the change and check if the
chart is being
rendered.","sha":"917473f8321fd56b90f18e5a88d643d5abb7eb29","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","apm:charts","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.15.0","v8.16.0","backport:version"],"title":"[APM
UI] Fix Latency distribution chart breaks due to transaction durations
of value
0","number":191994,"url":"https://github.com/elastic/kibana/pull/191994","mergeCommit":{"message":"[APM
UI] Fix Latency distribution chart breaks due to transaction durations
of value 0 (#191994)\n\n## Summary\r\nFixes:
https://github.com/elastic/kibana/issues/184256\r\n\r\nThis PR fixes the
APM latency distribution chart not being able to\r\nrender when we had
any duration value as 0, to fix it, we now check if\r\nit's 0 and
override it with
1.\r\n\r\n|Before|After|\r\n|-|-|\r\n\r\n|![image](https://github.com/user-attachments/assets/df224a1d-a669-4ea8-ad0e-9f81a82b904a)|![image](https://github.com/user-attachments/assets/cbf6957c-df6f-4f71-8f96-7985279912fa)|\r\n\r\n##
Test steps\r\n1. Open the following
file\r\n`x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_histogram_range_steps.ts`\r\n2.
Modify L61 and L118 changing the initial two values passed
to\r\n`getHistogramRangeSteps` to 0.\r\nLike `getHistogramRangeSteps(0,
0, steps)`.\r\nIt doesn't matter the order, if one of the params is at 0
it won't\r\nrender anything.\r\n3. Revert the change and check if the
chart is being
rendered.","sha":"917473f8321fd56b90f18e5a88d643d5abb7eb29"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/191994","number":191994,"mergeCommit":{"message":"[APM
UI] Fix Latency distribution chart breaks due to transaction durations
of value 0 (#191994)\n\n## Summary\r\nFixes:
https://github.com/elastic/kibana/issues/184256\r\n\r\nThis PR fixes the
APM latency distribution chart not being able to\r\nrender when we had
any duration value as 0, to fix it, we now check if\r\nit's 0 and
override it with
1.\r\n\r\n|Before|After|\r\n|-|-|\r\n\r\n|![image](https://github.com/user-attachments/assets/df224a1d-a669-4ea8-ad0e-9f81a82b904a)|![image](https://github.com/user-attachments/assets/cbf6957c-df6f-4f71-8f96-7985279912fa)|\r\n\r\n##
Test steps\r\n1. Open the following
file\r\n`x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_histogram_range_steps.ts`\r\n2.
Modify L61 and L118 changing the initial two values passed
to\r\n`getHistogramRangeSteps` to 0.\r\nLike `getHistogramRangeSteps(0,
0, steps)`.\r\nIt doesn't matter the order, if one of the params is at 0
it won't\r\nrender anything.\r\n3. Revert the change and check if the
chart is being
rendered.","sha":"917473f8321fd56b90f18e5a88d643d5abb7eb29"}}]}]
BACKPORT-->

Co-authored-by: Sergi Romeu <sergi.romeu@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:charts bug Fixes for quality problems that affect the customer experience good first issue low hanging fruit sdh-linked Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants