elastic / kibana

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

[Cloud Security] [Agentless] Include APM Trace Id in the X-Request-ID header in all Agentless API requests #192048

Open opauloh opened 1 week ago

opauloh commented 1 week ago

Summary

This ticket aims to include the X-Request-ID Header on all HTTP calls from the Kibana server to the Agentless API.

The X-Request-ID should be captured from the currentTraceparent provided by the APM service.

If a request is initiated as part of a background job, all Kibana transactions with the Agentless Api should happen after calling Apm's startTransaction.

Motivation

If a customer receives an error it can include the ID in a bug report, allowing the SDH operators to look up the corresponding log statements (without having to rely on timestamps, IPs, etc).

Also, this generated ID does not contain any sensitive information (client_id, cluster_id, etc), and won't violate the user's privacy as a unique ID is created per request it does help with tracking all the transactions related to a request when debugging an issue.

Definition of done

Related tasks/epics

elasticmachine commented 1 week ago

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

opauloh commented 2 days ago

I have a draft PR including the X-Request-ID using APM's traceparent, however, I had no success in testing the PR on the ESS environment with the QAF tool and the ci:cloud-deployment is not working, I'm blocking the issue until I can successfully test the changes with the QAF tool or when using the ci:cloud-deployment tag on the PR.