-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[CSM] fix ingest data retry order messed up #78163
Conversation
Pinging @elastic/apm-ui (Team:apm) |
💚 Build SucceededBuild metrics
To update your PR or re-run it, just comment with: |
item.body = item.body.replace( | ||
'"name":"client"', | ||
'"name":"opbean-client-rum"' | ||
); |
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.
How risky is it to do a string replace? We might want to manipulate the body as an object rather than a string.
function setItemMetaAndHeaders(item) { | ||
const headers = { | ||
'content-type': 'application/x-ndjson', | ||
}; | ||
|
||
if (SECRET_TOKEN) { | ||
headers.Authorization = `Bearer ${SECRET_TOKEN}`; | ||
} | ||
|
||
if (item.url === '/intake/v2/rum/events') { | ||
if (iterIndex === userAgents.length) { | ||
// set some event agent to opbean | ||
setRumAgent(item); | ||
iterIndex = 0; | ||
} | ||
headers['User-Agent'] = userAgents[iterIndex]; | ||
headers['X-Forwarded-For'] = userIps[iterIndex]; | ||
iterIndex++; | ||
} | ||
return headers; | ||
} | ||
|
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.
IMO we ran into this situation because of side-effects. If we can make this (more) functional, i.e. don't mutate item
and iterIndex
, I feel like this code would be more robust and easier to understand. I think changing insertItem()
to something like createRequestFromEvent()
would help.
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.
Sure, i will do it as a follow up PR, want to get this in to make sure it's working on other PRs.
* master: (31 commits) skip tests for old pacakge (elastic#78194) [Ingest Pipelines] Add url generator for ingest pipelines app (elastic#77872) [Lens] Rename "telemetry" to "stats" (elastic#78125) [CSM] Url search (elastic#77516) [Drilldowns] Config to disable URL Drilldown (elastic#77887) [Lens] Combined histogram/range aggregation for numbers (elastic#76121) Remove legacy plugins support (elastic#77599) 'Auto' interval must be correctly calculated for natural numbers (elastic#77995) [CSM] fix ingest data retry order messed up (elastic#78163) Add response status helpers (elastic#78006) Bump react-beautiful-dnd (elastic#78028) [Security Solution][Detection Engine] Bubbles up more error messages from ES queries to the UI (elastic#78004) Index pattern - refactor constructor (elastic#77791) Add `xpack.security.sameSiteCookies` to docker allow list (elastic#78192) Remove [key: string]: any; from IIndexPattern (elastic#77968) Remove requirement for manage_index_templates privilege for Index Management (elastic#77377) [Ingest Manager] Agent bulk actions UI (elastic#77690) [Metrics UI] Add inventory view timeline (elastic#77804) Reporting/Docs: Updates for setting to enable CSV Download (elastic#78101) Update to latest rum-react (elastic#78193) ...
Summary
Fixes #77645
Some custom headers were set on order of ingest, which ended up changing on retries. This PR fixes that.