[8.18] [APM][OTel] Encode service name in the APM URLs (#217092)#218477
Merged
jennypavlova merged 1 commit intoelastic:8.18from Apr 16, 2025
Merged
[8.18] [APM][OTel] Encode service name in the APM URLs (#217092)#218477jennypavlova merged 1 commit intoelastic:8.18from
jennypavlova merged 1 commit intoelastic:8.18from
Conversation
Closes elastic#213943 ## Summary This PR ensures the service name is always encoded in the APM UIs. It's a follow-up of elastic#215031 and aims to find a better solution to the problem: - Add the encoding directly to `formatRequest` as suggested there - I saw that there are many places where we use legacy Url builders, so I will try to replace them where possible and use apm router link method where the path is encoded ([ref](https://github.com/elastic/kibana/blob/7158e0201bf6becb4f2b821fb693bf6ed6365b54/src/platform/packages/shared/kbn-typed-react-router-config/src/create_router.ts#L184-L185)) - The PR includes the changes to address the issue above: - Replaced and removed `LegacyAPMLink` - Refactored `useAPMHref` to support encoding (and extracted and test the encoding logic) - Example usage: - Before: ```js useAPMHref({ path: `/services/${serviceName}/.....`, persistedFilters, }); ``` - After: ```js useAPMHref({ path: '/services/{serviceName}/.......}', pathParams: { serviceName }, persistedFilters, }); ``` - Used the APM router link method as much as possible ## Testing - Run `node scripts/synthtrace trace_with_service_names_with_slashes.ts --clean --live --uniqueIds --live` - Go to service inventory and click the links: https://github.com/user-attachments/assets/fcd4fbfc-4125-4cc8-9b00-53c5f375423f (cherry picked from commit f816e7b) # Conflicts: # x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/e2e/service_overview/otel_service_overview_and_transactions.cy.ts # x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/error_sample_detail.tsx # x-pack/solutions/observability/plugins/apm/public/components/app/service_map/controls.tsx # x-pack/solutions/observability/plugins/apm/public/components/app/top_traces_overview/trace_list.tsx # x-pack/solutions/observability/plugins/apm/public/components/routing/app_root/apm_header_action_menu/anomaly_detection_setup_link.tsx # x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/marker/error_marker.tsx
Contributor
|
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
rmyz
approved these changes
Apr 16, 2025
Contributor
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.18:Questions ?
Please refer to the Backport tool documentation