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

[ProfilingxAPM] Link APM from Profiling UI #180677

Merged
merged 23 commits into from
Apr 16, 2024

Conversation

cauemarcondes
Copy link
Contributor

@cauemarcondes cauemarcondes commented Apr 12, 2024

closes #178719

A new ES API has been created to support linking APM from the Profiling UI. It's called topN/functions. The new API allows grouping fields. So we first fetch functions grouping by service.name and when the user opens the APM Transactions we make another request grouping by transaction.name.

A new Advanced setting was created to toggle the old API on (fetch functions from Stacktraces API): It's turned off by default.
Screenshot 2024-04-12 at 10 39 36

When there are services on the selected function:
*If we cannot find the transaction, we show N/A.
Screenshot 2024-04-12 at 10 16 34

When there are no services on the selected function:
*hide the APM transactions section
Screenshot 2024-04-12 at 10 59 14

--
Performance boost:
The new API is faster than the Stacktraces API, especially because there's no logic on the Kibana side.
Stacktraces API:
Screenshot 2024-04-12 at 10 50 26

TopN/Functions API:
Screenshot 2024-04-12 at 10 51 20

@cauemarcondes cauemarcondes added release_note:feature Makes this part of the condensed release notes v8.14.0 labels Apr 12, 2024
@cauemarcondes cauemarcondes requested review from a team as code owners April 12, 2024 10:01
@botelastic botelastic bot added Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team labels Apr 12, 2024
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

A documentation preview will be available soon.

Request a new doc build by commenting
  • Rebuild this PR: run docs-build
  • Rebuild this PR and all Elastic docs: run docs-build rebuild

run docs-build is much faster than run docs-build rebuild. A rebuild should only be needed in rare situations.

If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status here.

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@iogbole
Copy link

iogbole commented Apr 12, 2024

@cauemarcondes - suggested copy for the accordion, using the style-for-forms accordion as an inspiration:

Tittle: Distributed Tracing Correlation

Sub-title: A curated view of APM services and transactions that call this function

APM Icon: https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt5c6b7c737bbb9532/657196b3d4041cbf8214c5c2/apm-logo-color-reverse-32px.svg

@mdbirnstiehl please review.

FYA @athre0z @christos68k

@iogbole
Copy link

iogbole commented Apr 12, 2024

Also, as discussed in Slack, the list should be sorted by the sample count in desc order, with the ability to filter by both service.name and transaction.name. Thank you

Copy link
Contributor

@mdbirnstiehl mdbirnstiehl left a comment

Choose a reason for hiding this comment

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

Looks good on my side. Thanks!

}),
truncateText: true,
sortable: true,
render(_, { serviceName, transactionName }) {
Copy link
Contributor

@kpatticha kpatticha Apr 15, 2024

Choose a reason for hiding this comment

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

The API doesn't return the transaction type? it could be an edge case but a service could have a 2 same transaction names but with different transaction type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now fetching the transaction type would mean making more ES queries for each service and transaction just to fetch the transaction types associated. At this point, I don't think it's worth doing it. Let's just make APM pick the first transaction type it finds based on the transaction name.

Copy link
Contributor

@kpatticha kpatticha left a comment

Choose a reason for hiding this comment

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

LGTM . I didn't test it manually though cause I don't have profiling data locally

@cauemarcondes cauemarcondes enabled auto-merge (squash) April 16, 2024 19:10
@cauemarcondes cauemarcondes merged commit b900b86 into elastic:main Apr 16, 2024
19 checks passed
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1676 1677 +1
observabilityShared 196 198 +2
profiling 288 291 +3
total +6

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/profiling-utils 48 55 +7
observability 661 669 +8
total +15

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.2MB 3.2MB +1.4KB
profiling 400.7KB 406.6KB +5.8KB
total +7.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 150.3KB 150.4KB +172.0B
observabilityShared 63.2KB 64.1KB +911.0B
profiling 18.0KB 18.2KB +270.0B
total +1.3KB
Unknown metric groups

API count

id before after diff
@kbn/profiling-utils 161 168 +7
observability 670 678 +8
total +15

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 16, 2024
@cauemarcondes cauemarcondes deleted the profiling-apm-link-2 branch April 17, 2024 10:53
cauemarcondes added a commit that referenced this pull request Apr 30, 2024
…es (#182001)

Related to #180677
closes #181886

There's still a small difference on the CO2 values, but that's due to
different formats returned by ES apis:
```
TopN Functions
"self_annual_co2_tons": 0.0068555964801996295

Flamegraph
"AnnualCO2TonsInclusive": [
    0.0069,
```

After:
<img width="1765" alt="Screenshot 2024-04-29 at 16 34 57"
src="https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188">
<img width="1788" alt="Screenshot 2024-04-29 at 16 35 03"
src="https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67">
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 30, 2024
…es (elastic#182001)

Related to elastic#180677
closes elastic#181886

There's still a small difference on the CO2 values, but that's due to
different formats returned by ES apis:
```
TopN Functions
"self_annual_co2_tons": 0.0068555964801996295

Flamegraph
"AnnualCO2TonsInclusive": [
    0.0069,
```

After:
<img width="1765" alt="Screenshot 2024-04-29 at 16 34 57"
src="https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188">
<img width="1788" alt="Screenshot 2024-04-29 at 16 35 03"
src="https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67">

(cherry picked from commit cb77c2d)
kibanamachine referenced this pull request Apr 30, 2024
…nt values (#182001) (#182091)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Profiling] Differential views based on same data show different
values (#182001)](#182001)

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

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

<!--BACKPORT [{"author":{"name":"Cauê
Marcondes","email":"55978943+cauemarcondes@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-04-30T09:47:33Z","message":"[Profiling]
Differential views based on same data show different values
(#182001)\n\nRelated to
https://github.com/elastic/kibana/pull/180677\r\ncloses
https://github.com/elastic/kibana/issues/181886\r\n\r\nThere's still a
small difference on the CO2 values, but that's due to\r\ndifferent
formats returned by ES apis:\r\n```\r\nTopN
Functions\r\n\"self_annual_co2_tons\":
0.0068555964801996295\r\n\r\nFlamegraph\r\n\"AnnualCO2TonsInclusive\":
[\r\n 0.0069,\r\n```\r\n\r\nAfter:\r\n<img width=\"1765\"
alt=\"Screenshot 2024-04-29 at 16 34
57\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188\">\r\n<img
width=\"1788\" alt=\"Screenshot 2024-04-29 at 16 35
03\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67\">","sha":"cb77c2d13eecf92b064328605a34737222fed541","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","ci:project-deploy-observability","v8.14.0","v8.15.0"],"title":"[Profiling]
Differential views based on same data show different
values","number":182001,"url":"https://github.com/elastic/kibana/pull/182001","mergeCommit":{"message":"[Profiling]
Differential views based on same data show different values
(#182001)\n\nRelated to
https://github.com/elastic/kibana/pull/180677\r\ncloses
https://github.com/elastic/kibana/issues/181886\r\n\r\nThere's still a
small difference on the CO2 values, but that's due to\r\ndifferent
formats returned by ES apis:\r\n```\r\nTopN
Functions\r\n\"self_annual_co2_tons\":
0.0068555964801996295\r\n\r\nFlamegraph\r\n\"AnnualCO2TonsInclusive\":
[\r\n 0.0069,\r\n```\r\n\r\nAfter:\r\n<img width=\"1765\"
alt=\"Screenshot 2024-04-29 at 16 34
57\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188\">\r\n<img
width=\"1788\" alt=\"Screenshot 2024-04-29 at 16 35
03\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67\">","sha":"cb77c2d13eecf92b064328605a34737222fed541"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182001","number":182001,"mergeCommit":{"message":"[Profiling]
Differential views based on same data show different values
(#182001)\n\nRelated to
https://github.com/elastic/kibana/pull/180677\r\ncloses
https://github.com/elastic/kibana/issues/181886\r\n\r\nThere's still a
small difference on the CO2 values, but that's due to\r\ndifferent
formats returned by ES apis:\r\n```\r\nTopN
Functions\r\n\"self_annual_co2_tons\":
0.0068555964801996295\r\n\r\nFlamegraph\r\n\"AnnualCO2TonsInclusive\":
[\r\n 0.0069,\r\n```\r\n\r\nAfter:\r\n<img width=\"1765\"
alt=\"Screenshot 2024-04-29 at 16 34
57\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188\">\r\n<img
width=\"1788\" alt=\"Screenshot 2024-04-29 at 16 35
03\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67\">","sha":"cb77c2d13eecf92b064328605a34737222fed541"}}]}]
BACKPORT-->

Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
mbondyra pushed a commit to mbondyra/kibana that referenced this pull request May 2, 2024
…es (elastic#182001)

Related to elastic#180677
closes elastic#181886

There's still a small difference on the CO2 values, but that's due to
different formats returned by ES apis:
```
TopN Functions
"self_annual_co2_tons": 0.0068555964801996295

Flamegraph
"AnnualCO2TonsInclusive": [
    0.0069,
```

After:
<img width="1765" alt="Screenshot 2024-04-29 at 16 34 57"
src="https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188">
<img width="1788" alt="Screenshot 2024-04-29 at 16 35 03"
src="https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67">
yuliacech pushed a commit to yuliacech/kibana that referenced this pull request May 3, 2024
…es (elastic#182001)

Related to elastic#180677
closes elastic#181886

There's still a small difference on the CO2 values, but that's due to
different formats returned by ES apis:
```
TopN Functions
"self_annual_co2_tons": 0.0068555964801996295

Flamegraph
"AnnualCO2TonsInclusive": [
    0.0069,
```

After:
<img width="1765" alt="Screenshot 2024-04-29 at 16 34 57"
src="https://github.com/elastic/kibana/assets/55978943/092a704f-69fe-4dd0-99d5-9ac9bce77188">
<img width="1788" alt="Screenshot 2024-04-29 at 16 35 03"
src="https://github.com/elastic/kibana/assets/55978943/da4a1406-fad7-48de-81ac-e8aae64cba67">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Profiling] Link to APM