[APM] Explicitly set environment for cross-service links#87481
[APM] Explicitly set environment for cross-service links#87481dgieselaar merged 10 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/apm-ui (Team:apm) |
|
@elasticmachine merge upstream |
sorenlouv
left a comment
There was a problem hiding this comment.
lgtm. I expect we'll remove the logic in isEnvironmentEqualToQueryEnvironment in 7.12 as we remove the "all" option?
…ana into environment-cross-service
|
@sqren I made some changes, maybe good to have another look |
| requestedEnvironment?: string, | ||
| queryEnvironment?: string |
There was a problem hiding this comment.
Perhaps:
| requestedEnvironment?: string, | |
| queryEnvironment?: string | |
| requestedEnvironment?: string, | |
| currentEnvironment?: string |
There was a problem hiding this comment.
I wanted to keep this as queryEnvironment because how an empty value is interpreted is specific to whether it's a query parameter. Maybe currentQueryEnvironment is a good compromise here, but happy to go with your suggestion as well.
| ) { | ||
| const normalizedRequestedEnvironment = | ||
| requestedEnvironment || ENVIRONMENT_NOT_DEFINED.value; | ||
| const normalizedQueryEnvironment = queryEnvironment || ENVIRONMENT_ALL.value; |
There was a problem hiding this comment.
I'm wondering if we should change the default so that if no environment is set (in the url) it'll default to ENVIRONMENT_NOT_DEFINED.value.
Ideally when empty I think it should pick "production" if that's available or the top environment. This is similar to what we do with transaction type.
There was a problem hiding this comment.
Hmm, I think all is a good default here - there's no all option for transaction types so maybe not the right thing to compare it to.
sorenlouv
left a comment
There was a problem hiding this comment.
Just a few comments. Feel free to merge as-is
| return environmentLabels[environment] || environment; | ||
| } | ||
|
|
||
| export function getEnvironmentUrlParam( |
There was a problem hiding this comment.
Can you add a comment why this helper is needed?
| const nextEnvironment = getEnvironmentUrlParam( | ||
| rootTransaction?.service.environment, | ||
| environment | ||
| ); |
There was a problem hiding this comment.
This would be easier to understand if it was destructured:
| const nextEnvironment = getEnvironmentUrlParam( | |
| rootTransaction?.service.environment, | |
| environment | |
| ); | |
| const nextEnvironment = getEnvironmentUrlParam({ | |
| requestedEnvironment: rootTransaction?.service.environment, | |
| currentEnvironment: environment | |
| }); |
| ? `/services/${serviceName}/service-map` | ||
| : '/service-map'; | ||
| return useAPMHref(pathFor); | ||
| return useAPMHref({ path: pathFor }); |
There was a problem hiding this comment.
Can you rename pathFor to path or inline it?
| return useAPMHref({ path: pathFor }); | |
| return useAPMHref({ path }); |
| }; | ||
|
|
||
| return getAPMHref({ basePath, path, query, search }); | ||
| return getAPMHref({ basePath, path, query: nextQuery, search }); |
There was a problem hiding this comment.
Good idea destructuring useAPMHref 👍
As I mentioned to @cauemarcondes in another PR, I don't think getAPMHref should take both query and search (the latter is essentially just a serialised version of the former). But that can wait until 7.12.
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* master: (33 commits) [Security Solution][Case] Fix patch cases integration test with alerts (elastic#88311) [Security Solutions][Detection Engine] Removes duplicate API calls (elastic#88420) Fix log msg (elastic#88370) [Test] Add tag cloud visualization to dashboard in functional test for reporting (elastic#87600) removing kibana-core-ui from codeowners (elastic#88111) [Alerting] Migrate Event Log plugin to TS project references (elastic#81557) [Maps] fix zooming while drawing shape filter logs errors in console (elastic#88413) Porting fixes 1 (elastic#88477) [APM] Explicitly set environment for cross-service links (elastic#87481) chore(NA): remove mocha junit ci integrations (elastic#88129) [APM] Only display relevant sections for rum agent in service overview (elastic#88410) [Enterprise Search] Automatically mock shared logic files (elastic#88494) [APM] Disable Create custom link button on Transaction details page for read-only users [Docs] clean-up vega map reference documenation (elastic#88487) [Security Solution] Fix Timeline event details layout (elastic#88377) Change DELETE to POST for _bulk_delete to avoid incompatibility issues (elastic#87914) [Monitoring] Change cloud messaging on no data page (elastic#88375) [Uptime] clear ping state when PingList component in unmounted (elastic#88321) [APM] Consistent terminology for latency and throughput (elastic#88452) fix copy (elastic#88481) ...
Closes #87028.