Skip to content

Commit

Permalink
Consider context in raw serialization
Browse files Browse the repository at this point in the history
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 elastic#106103
  • Loading branch information
danielmitterdorfer committed Mar 11, 2024
1 parent 721d9fa commit 58b1ce1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public void writeRawValue(InputStream stream, XContentType xContentType) throws
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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: >
Expand Down

0 comments on commit 58b1ce1

Please sign in to comment.