-
Notifications
You must be signed in to change notification settings - Fork 882
Enable reusuable_data memory mode by default #6799
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ | |
import java.io.UncheckedIOException; | ||
import java.net.InetSocketAddress; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.LinkedBlockingQueue; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.function.Predicate; | ||
import javax.annotation.Nullable; | ||
|
@@ -82,7 +83,13 @@ public static PrometheusHttpServerBuilder builder() { | |
// sequentially. | ||
if (memoryMode == MemoryMode.REUSABLE_DATA) { | ||
executor = | ||
Executors.newSingleThreadExecutor(new DaemonThreadFactory("prometheus-http-server")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way you described it makes it sound like a shortcoming in the test/assertions...which is a bummer that the implementation had to change to accommodate it. It seems fine, but I can't fully reason about the impact of having a non-finalizable executorservice. I'm overthinking it. |
||
new ThreadPoolExecutor( | ||
1, | ||
1, | ||
0L, | ||
TimeUnit.MILLISECONDS, | ||
new LinkedBlockingQueue<>(), | ||
new DaemonThreadFactory("prometheus-http-server")); | ||
} | ||
try { | ||
this.httpServer = | ||
|
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.
This change seems random, but is actually oddly needed for a subtle reason. The OTLP exporter tests generate fake test data, serialize and send it to a mock server, where it is deserialized into generated proto classes and evaluated for equality. As you're probably aware, OTLP payloads consist of a series of enclosing envelopes, e.g. for logs ResourceLogs enclose ScopeLogs enclose LogRecords. When an OTLP exporter recieves a
List<LogRecordData>
, the records need to be grouped by resource and scope to match the OTLP payload structure. We do this using identity hash maps. Notably, the reuseable memory mode serialization iterates over identity the identity hash maps slightly differently than the immutable memory mode variant. This means that when a group of records is exported with scopes which are equal but not identical, the order of those ScopeLogs in the serialized payload is not the same for immutable memory mode and reuseable memory mode.We can make the tests pass by having the fake log records use identical scopes, which sidesteps the difference in iteration order between immutable memory mode and reuseable memory mode.
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.
Thanks for the clarification....this is a clever workaround.