elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.72k stars 8.14k forks source link

[APM] When creating Trace Explorer links `transaction.id` is replaced when page is loaded #171368

Open spong opened 10 months ago

spong commented 10 months ago

We're instrumenting the Security Assistant with APM and linking off to the Trace Explorer UI for any given message that has a transaction/trace id. E.g.

const apmTraceLink =
    message.traceData != null
      ? `${basePath}/app/apm/traces/explorer/waterfall?comparisonEnabled=false&detailTab=timeline&environment=ENVIRONMENT_ALL&kuery=&query=transaction.id:%20${message.traceData.transactionId}&rangeFrom=now-1y/d&rangeTo=now&showCriticalPath=false&traceId=${message.traceData.traceId}&transactionId=${message.traceData.transactionId}&type=kql&waterfallItemId=`
      : undefined; 

I first started by just copying the main URL from the Trace Explorer page and replacing traceId and transactionId ala:

http://localhost:5601/kbn/app/apm/traces/explorer/waterfall?comparisonEnabled=false&detailTab=timeline&environment=ENVIRONMENT_ALL&kuery=&query=&rangeFrom=now-1y/d&rangeTo=now&showCriticalPath=false&traceId=37d559d825f68d3b5251f8e16029c604&transactionId=83c8c2c5f680a65d&type=kql&waterfallItemId=

traceId=37d559d825f68d3b5251f8e16029c604
transactionId=83c8c2c5f680a65d

however I noticed that when navigating to the route both the traceId and transactionId were rewritten:

http://localhost:5601/kbn/app/apm/traces/explorer/waterfall?comparisonEnabled=false&detailTab=timeline&environment=ENVIRONMENT_ALL&kuery=&query=&rangeFrom=now-1y/d&rangeTo=now&showCriticalPath=false&traceId=bedffbd989af4982cd7530794bc32c8c&transactionId=019047f20836c69a&type=kql&waterfallItemId=

traceId=bedffbd989af4982cd7530794bc32c8c
transactionId=019047f20836c69a

I then constructed a link with a kql query param for filtering on transaction.id. While the transactionId param got updated to 4a5ff15270e35400 from of 83c8c2c5f680a65d, it seems the search filter overrides this and gives the correct view:

http://localhost:5601/kbn/app/apm/traces/explorer/waterfall?comparisonEnabled=false&detailTab=timeline&environment=ENVIRONMENT_ALL&kuery=&query=transaction.id:%2083c8c2c5f680a65d&rangeFrom=now-1y/d&rangeTo=now&showCriticalPath=false&traceId=37d559d825f68d3b5251f8e16029c604&transactionId=4a5ff15270e35400&type=kql&waterfallItemId=

traceId=37d559d825f68d3b5251f8e16029c604 (not replaced this time!)
transactionId=4a5ff15270e35400
elasticmachine commented 10 months ago

Pinging @elastic/apm-ui (Team:APM)

elasticmachine commented 10 months ago

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

botelastic[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.