Consider context in raw serialization (#106163)

With this commit we use `writeRawValue` instead of `writeRaw` when
serializing raw strings as XContent. The latter method does not consider
context (e.g. is the value being written as part of an array and
requires a comma separator?) whereas the former does. This ensures that
pre-rendered double values as we use them in the flamegraph response are
rendered correctly as XContent.

Closes #106103
This commit is contained in:
Daniel Mitterdorfer 2024-03-11 13:48:12 +01:00 committed by GitHub
parent be1cf31cf8
commit 890bd4b8a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 7 deletions

View File

@ -500,7 +500,7 @@ public class JsonXContentGenerator implements XContentGenerator {
public void writeRawValue(String value) throws IOException {
try {
if (supportsRawWrites()) {
generator.writeRaw(value);
generator.writeRawValue(value);
} else {
// fallback to a regular string for formats that don't allow writing the value as is
generator.writeString(value);

View File

@ -166,9 +166,6 @@ teardown:
---
"Test flamegraph from profiling-events":
- skip:
reason: "https://github.com/elastic/elasticsearch/issues/106103"
version: "all"
- do:
profiling.flamegraph:
body: >
@ -195,9 +192,6 @@ teardown:
---
"Test flamegraph from test-events":
- skip:
reason: "https://github.com/elastic/elasticsearch/issues/106103"
version: "all"
- do:
profiling.flamegraph:
body: >