-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[APM] Explicitly set environment for cross-service links #87481
[APM] Explicitly set environment for cross-service links #87481
Conversation
Pinging @elastic/apm-ui (Team:apm) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps:
requestedEnvironment?: string, | |
queryEnvironment?: string | |
requestedEnvironment?: string, | |
currentEnvironment?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments. Feel free to merge as-is
@@ -33,3 +33,18 @@ export const ENVIRONMENT_NOT_DEFINED = { | |||
export function getEnvironmentLabel(environment: string) { | |||
return environmentLabels[environment] || environment; | |||
} | |||
|
|||
export function getEnvironmentUrlParam( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment why this helper is needed?
const nextEnvironment = getEnvironmentUrlParam( | ||
rootTransaction?.service.environment, | ||
environment | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
}); |
@@ -11,7 +11,7 @@ export function useServiceMapHref(serviceName?: string) { | |||
const pathFor = serviceName | |||
? `/services/${serviceName}/service-map` | |||
: '/service-map'; | |||
return useAPMHref(pathFor); | |||
return useAPMHref({ path: pathFor }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.