elastic / kibana

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

APM sourcemap API outputs unhelpfully large error logs #189919

Open smith opened 3 months ago

smith commented 3 months ago

From internal Slack:

I just noticed some HUGE documents in the Kibana logs from APM. The message field (not indexed) is ~4MB, and appears to be duplicated in error.message... I’ve also noticed Discover complaining about async results > 10MB or something, not showing me the docs (but showing the graphs), thinking this could be the culprit. Here’s the start of one of the messages: Invalid value "globalThis.$localize=Object.assign(globalThis.$localize ||

When somebody attempts to POST /api/apm/sourcemaps and the request fails, the error message will show in the Kibana logs:

Invalid value "..." supplied to : merge/0: { body: { service_name: string, service_version: string, bundle_filepath: string, sourcemap: pipe(pipe((string | stringFromBufferRt), JSON), ({ version: number, sources: Array<string>, mappings: string } & Partial<{ names: Array<string>, file: string, sourceRoot: string, sourcesContent: Array<(string | null)> }>)) } }/body: { service_name: string, service_version: string, bundle_filepath: string, sourcemap: pipe(pipe((string | stringFromBufferRt), JSON), ({ version: number, sources: Array<string>, mappings: string } & Partial<{ names: Array<string>, file: string, sourceRoot: string, sourcesContent: Array<(string | null)> }>)) }/sourcemap: pipe(pipe((string | stringFromBufferRt), JSON), ({ version: number, sources: Array<string>, mappings: string } & Partial<{ names: Array<string>, file: string, sourceRoot: string, sourcesContent: Array<(string | null)> }>))

This error message comes from io-ts, and in this example the ... is the whole sourcemap which can be quite large. The sourcemap should not be printed to the logs.

By default io-ts has very ugly error messages that aren't helpful to end users. However, the scope of this issue is only to solve the problem of very large log output. Any other improvements to the error message output are optional benefits.

✔️ Acceptance critieria

elasticmachine commented 3 months ago

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