Skip to content

Conversation

@jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Apr 10, 2025

Summary

This PR fixes the issue with the error summary missing items using edot. It includes e2e tests with synthtrace for both edot and otel services.

TODO

  • Test with serverless (waiting for the PR to be deployed)
    Tested on serverless works as expected:
image

const userAgent = error?.user_agent;
const errorUrl =
(error.error.page?.url || error.url?.full) ?? buildUrl(error?.url ? error : transaction);
const method = error.http?.request?.method ?? transaction?.http?.request?.method;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a super nit thing, and maybe not even relevant, nevertheless:

Since we want to make our product OTel native and transaction is not an OTel concept and we have countless issues by having it, this caught my eye. I know this is already existing code, and we need backwards compatibility, where transaction is a real thing.

Nevertheless: transaction here is just a variable name, that point to the root span, right? Any thought on maybe going with rootSpan or something like that?

This is probably all good, it just worries me a bit, that transaction keeps spreading in the code.

This is really a nit and unfortunately I don't really have a suggestion here - this is more like an fyi for consideration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @gregkalapos,

Nevertheless: transaction here is just a variable name, that point to the root span, right? Any thought on maybe going with rootSpan or something like that?

I checked the logic to get the "transaction" data from the error and we use transaction id OR span id (ref) so some of those fallbacks (also the existing ones before my change) were used for the APM use-cases (in case some of the information is not present in the error we were checking the associated transaction)

Since we want to make our product OTel native and transaction is not an OTel concept and we have countless issues by having it, this caught my eye. I know this is already existing code, and we need backwards compatibility, where transaction is a real thing.

I totally agree that we should go with the OTel native approach but also the whole "error" concept is different when we compare APM and OTel. As we still use this one for APM transactions or OTel spans I would keep the transaction name for now (otherwise I nee to change many different places that are not part of the errors logic I am fixing here). As this might create confusion for OTel I will add a comment above to explain and will be happy to migrate to OTel schema everywhere (which would require more changes but would make it much easier to work with when we have OTel data) but anyway thanks for the comment :)

@jennypavlova jennypavlova self-assigned this Apr 11, 2025
@jennypavlova jennypavlova added release_note:fix v9.0.0 Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Apr 11, 2025
@jennypavlova jennypavlova marked this pull request as ready for review April 11, 2025 14:29
@jennypavlova jennypavlova requested a review from a team as a code owner April 11, 2025 14:29
@elasticmachine
Copy link
Contributor

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

@jennypavlova jennypavlova added the ci:project-deploy-observability Create an Observability project label Apr 11, 2025
@github-actions
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.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova jennypavlova added ci:cloud-redeploy Always create a new Cloud deployment ci:project-deploy-observability Create an Observability project and removed ci:project-deploy-observability Create an Observability project labels Apr 11, 2025
@github-actions
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.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova
Copy link
Member Author

/oblt-deploy

transaction?.url?.full ||
buildUrl(error?.url ? error : transaction);
const method = error.http?.request?.method ?? transaction?.http?.request?.method;
const status = error.http?.response?.status_code ?? transaction?.http?.response?.status_code;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we create a variable to know if we are actually using the error or the transaction object?
I think it will be hard to debug as it is right now, since we don't know which value are we using with that many || and ??.
Something like const errorData = error.X ? error : transaction; and use it then const method = objectKind.http?.request?.method.... The naming can be improved but is just an example, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the comment, I understand it looks a bit confusing. I tried to extract some parts to some new variables. You can take a look at the latest changes and let me know if you think that I should change them :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for applying the changes @jennypavlova !
I was thinking about checking where the data is once and then using that variable, for example:
const source = error.http ? error : transaction.
Then we can use const userAgent = source?.user_agent.
The objective would be to remove redundant checks, as we will have all the information in one place, whether it's error or transaction, does it make sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @rmyz, I tried to do something similar at the beginning but there is no guarantee that if the field X is present in an error all the other fields will be as well (I couldn't find such field - I know in theory this should not happen but for example the user agent fallback was added even before this otel changes here.

const source = error.http ? error : transaction.
Then we can use const userAgent = source?.user_agent.

So the problem I see here is that we could have the error.http but the user_agent to come from a transaction. I kept the other check to be safe and to make sure we always have a fallback if the error values are not there

Copy link
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

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

Code LGTM, added a small nit

};
server?: {
address?: string;
port?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean just string and not optional? It is string now 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the confusion is because the Opentelemetry port is considered an Integer, while we treat it as a string

Copy link
Contributor

Choose a reason for hiding this comment

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

it's an integer on both ECS and semconv

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm true, same in ECS, I guess I got it mixed with a different property... I will set it to be a number everywhere, thank you both!

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed some other changes to make sure we convert it to number where needed and set the number type everywhere

<EuiIcon type="discoverApp" />
</EuiFlexItem>
<EuiFlexItem style={{ whiteSpace: 'nowrap' }}>
<EuiFlexItem css={{ whiteSpace: 'nowrap' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@jennypavlova jennypavlova force-pushed the fix-edot-error-summary-transaction-fallback branch from 7471321 to f3314ab Compare April 14, 2025 09:28
@jennypavlova jennypavlova force-pushed the fix-edot-error-summary-transaction-fallback branch from f3314ab to 3b854b7 Compare April 14, 2025 15:41
Copy link
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

LGTM!

@jennypavlova
Copy link
Member Author

Check serverless with latest changes (EDOT and APM cases) ✅
image
image

@jennypavlova jennypavlova enabled auto-merge (squash) April 15, 2025 17:58
@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 15, 2025

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
apm 2.6MB 2.6MB +437.0B

History

cc @jennypavlova

@jennypavlova jennypavlova merged commit 7c9a3ee into elastic:main Apr 15, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

@kibanamachine
Copy link
Contributor

jennypavlova added a commit to jennypavlova/kibana that referenced this pull request Apr 16, 2025
## Summary

This PR fixes the issue with the error summary missing items using edot.
It includes e2e tests with synthtrace for both edot and otel services.

TODO

- [x] Test with serverless (waiting for the PR to be deployed)
Tested on serverless works as expected:

<img width="2560" alt="image"
src="https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f"
/>

(cherry picked from commit 7c9a3ee)

# Conflicts:
#	x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/e2e/service_overview/otel_edot_service_overview_and_transactions.cy.ts
#	x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/fixtures/synthtrace/adservice_edot.ts
@jennypavlova
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.0
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

jennypavlova added a commit to jennypavlova/kibana that referenced this pull request Apr 16, 2025
## Summary

This PR fixes the issue with the error summary missing items using edot.
It includes e2e tests with synthtrace for both edot and otel services.

TODO

- [x] Test with serverless (waiting for the PR to be deployed)
Tested on serverless works as expected:

<img width="2560" alt="image"
src="https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f"
/>

(cherry picked from commit 7c9a3ee)

# Conflicts:
#	x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/e2e/service_overview/otel_edot_service_overview_and_transactions.cy.ts
#	x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/fixtures/synthtrace/adservice_edot.ts
jennypavlova added a commit that referenced this pull request Apr 16, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM][OTel] EDOT error summary fix
(#217885)](#217885)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-15T19:44:11Z","message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","ci:cloud-redeploy","ci:build-serverless-image","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[APM][OTel]
EDOT error summary
fix","number":217885,"url":"https://github.com/elastic/kibana/pull/217885","mergeCommit":{"message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217885","number":217885,"mergeCommit":{"message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
jennypavlova added a commit that referenced this pull request Apr 17, 2025
# Backport

This will backport the following commits from `main` to `9.0`:
- [[APM][OTel] EDOT error summary fix
(#217885)](#217885)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-15T19:44:11Z","message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","ci:cloud-redeploy","ci:build-serverless-image","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[APM][OTel]
EDOT error summary
fix","number":217885,"url":"https://github.com/elastic/kibana/pull/217885","mergeCommit":{"message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217885","number":217885,"mergeCommit":{"message":"[APM][OTel]
EDOT error summary fix (#217885)\n\n## Summary\n\nThis PR fixes the
issue with the error summary missing items using edot.\nIt includes e2e
tests with synthtrace for both edot and otel services.\n\nTODO \n\n- [x]
Test with serverless (waiting for the PR to be deployed)\nTested on
serverless works as expected: \n\n<img width=\"2560\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/8dd7962e-7d66-482d-97fb-0b08882bd04f\"\n/>","sha":"7c9a3ee1f2a7f4599cd294ef2890e7c1b9cefd27"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels ci:build-serverless-image ci:cloud-redeploy Always create a new Cloud deployment ci:project-deploy-observability Create an Observability project release_note:fix Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v8.19.0 v9.0.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants