[8.16] [APM] Fix: Add tracing sample missing fields in the overview (#206932) (#206983)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[APM] Fix: Add tracing sample missing fields in the overview
(#206932)](https://github.com/elastic/kibana/pull/206932)

<!--- Backport version: 9.6.4 -->

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

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2025-01-16T16:45:06Z","message":"[APM]
Fix: Add tracing sample missing fields in the overview
(#206932)\n\nCloses #200474\r\n\r\n## Summary\r\n\r\nThis PR fixes the
issue with tracing sample missing URL/Status Code/User\r\nAgent fields
in the overview\r\n\r\n## Testing\r\n- Open the APM UI and find APM
traces that contains `url.full` /\r\n`transaction.page.url`,
`http.request.method` and\r\n`http.response.status_code`\r\n- One should
be ingested using an otel collector the other should use
an\r\napm-server\r\n- if using oblt cluster you can check transactions
from `loadgenerator`\r\nand `opbeans-python` for example\r\n - check the
trace summary:\r\n - Otel:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/871172b6-8307-4aa2-844e-73a8405da746)\r\n\r\n
- APM server:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/ef233cf4-0fbb-49c2-8f09-d4299a34ec8c)","sha":"1d493c0a8df778ca8bfd86dbf11d59c8aa3d548c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","Team:obs-ux-infra_services"],"title":"[APM]
Fix: Add tracing sample missing fields in the
overview","number":206932,"url":"https://github.com/elastic/kibana/pull/206932","mergeCommit":{"message":"[APM]
Fix: Add tracing sample missing fields in the overview
(#206932)\n\nCloses #200474\r\n\r\n## Summary\r\n\r\nThis PR fixes the
issue with tracing sample missing URL/Status Code/User\r\nAgent fields
in the overview\r\n\r\n## Testing\r\n- Open the APM UI and find APM
traces that contains `url.full` /\r\n`transaction.page.url`,
`http.request.method` and\r\n`http.response.status_code`\r\n- One should
be ingested using an otel collector the other should use
an\r\napm-server\r\n- if using oblt cluster you can check transactions
from `loadgenerator`\r\nand `opbeans-python` for example\r\n - check the
trace summary:\r\n - Otel:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/871172b6-8307-4aa2-844e-73a8405da746)\r\n\r\n
- APM server:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/ef233cf4-0fbb-49c2-8f09-d4299a34ec8c)","sha":"1d493c0a8df778ca8bfd86dbf11d59c8aa3d548c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206932","number":206932,"mergeCommit":{"message":"[APM]
Fix: Add tracing sample missing fields in the overview
(#206932)\n\nCloses #200474\r\n\r\n## Summary\r\n\r\nThis PR fixes the
issue with tracing sample missing URL/Status Code/User\r\nAgent fields
in the overview\r\n\r\n## Testing\r\n- Open the APM UI and find APM
traces that contains `url.full` /\r\n`transaction.page.url`,
`http.request.method` and\r\n`http.response.status_code`\r\n- One should
be ingested using an otel collector the other should use
an\r\napm-server\r\n- if using oblt cluster you can check transactions
from `loadgenerator`\r\nand `opbeans-python` for example\r\n - check the
trace summary:\r\n - Otel:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/871172b6-8307-4aa2-844e-73a8405da746)\r\n\r\n
- APM server:\r\n
\r\n\r\n![image](https://github.com/user-attachments/assets/ef233cf4-0fbb-49c2-8f09-d4299a34ec8c)","sha":"1d493c0a8df778ca8bfd86dbf11d59c8aa3d548c"}},{"url":"https://github.com/elastic/kibana/pull/206978","number":206978,"branch":"8.x","state":"OPEN"}]}]
BACKPORT-->
This commit is contained in:
jennypavlova 2025-01-17 01:27:00 +01:00 committed by GitHub
parent e113fbf0a9
commit e3d35f9bb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 2 deletions

View file

@ -12,7 +12,7 @@ export interface UserAgent {
name: string;
};
name?: string;
original: string;
original?: string;
os?: {
name: string;
version?: string;

View file

@ -29,6 +29,11 @@ Object {
"transaction.type",
"processor.name",
"service.language.name",
"url.full",
"transaction.page.url",
"http.response.status_code",
"http.request.method",
"user_agent.name",
],
"query": Object {
"bool": Object {

View file

@ -25,6 +25,11 @@ import {
SPAN_LINKS,
TRANSACTION_AGENT_MARKS,
SERVICE_LANGUAGE_NAME,
URL_FULL,
HTTP_REQUEST_METHOD,
HTTP_RESPONSE_STATUS_CODE,
TRANSACTION_PAGE_URL,
USER_AGENT_NAME,
} from '../../../../common/es_fields/apm';
import { asMutableArray } from '../../../../common/utils/as_mutable_array';
import { APMEventClient } from '../../../lib/helpers/create_es_client/create_apm_event_client';
@ -58,7 +63,15 @@ export async function getTransaction({
TRANSACTION_TYPE,
] as const);
const optionalFields = asMutableArray([PROCESSOR_NAME, SERVICE_LANGUAGE_NAME] as const);
const optionalFields = asMutableArray([
PROCESSOR_NAME,
SERVICE_LANGUAGE_NAME,
URL_FULL,
TRANSACTION_PAGE_URL,
HTTP_RESPONSE_STATUS_CODE,
HTTP_REQUEST_METHOD,
USER_AGENT_NAME,
] as const);
const resp = await apmEventClient.search('get_transaction', {
apm: {