Skip to content

Commit

Permalink
Remove metric advice benchmark test
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Aug 12, 2024
1 parent 2a9ad4b commit 69f3c30
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public void record(ThreadState threadState) {

@SuppressWarnings("ImmutableEnumChecker")
public enum InstrumentParam {
/**
* Record HTTP span attributes without advice. This baseline shows the CPU and memory allocation
* independent of advice.
*/
NO_ADVICE_ALL_ATTRIBUTES(
new Instrument() {
private LongCounter counter;
Expand All @@ -147,6 +151,13 @@ void record(long value) {
counter.add(value, httpServerSpanAttributes());
}
}),
/**
* Record HTTP metric attributes without advice. This baseline shows the lower bound if
* attribute filtering was done in instrumentation instead of the metrics SDK with advice. It's
* not quite fair though because instrumentation would have to separately allocate attributes
* for spans and metrics, whereas with advice, we can manage to only allocate span attributes
* and a lightweight metrics attributes view derived from span attributes.
*/
NO_ADVICE_FILTERED_ATTRIBUTES(
new Instrument() {
private LongCounter counter;
Expand All @@ -161,6 +172,10 @@ void record(long value) {
counter.add(value, httpServerMetricAttributes());
}
}),
/**
* Record cached HTTP span attributes without advice. This baseline helps isolate the CPU and
* memory allocation for recording vs. creating attributes.
*/
NO_ADVICE_ALL_ATTRIBUTES_CACHED(
new Instrument() {
private LongCounter counter;
Expand All @@ -175,6 +190,10 @@ void record(long value) {
counter.add(value, CACHED_HTTP_SERVER_SPAN_ATTRIBUTES);
}
}),
/**
* Record HTTP span attributes with advice filtering to HTTP metric attributes. This is meant to
* realistically demonstrate a typical HTTP server instrumentation scenario.
*/
ADVICE_ALL_ATTRIBUTES(
new Instrument() {
private LongCounter counter;
Expand All @@ -192,6 +211,10 @@ void record(long value) {
counter.add(value, httpServerSpanAttributes());
}
}),
/**
* Record HTTP metric attributes with advice filtering to HTTP metric attributes. This
* demonstrates the overhead of advice when no attributes are filtered.
*/
ADVICE_FILTERED_ATTRIBUTES(
new Instrument() {
private LongCounter counter;
Expand All @@ -209,6 +232,10 @@ void record(long value) {
counter.add(value, httpServerMetricAttributes());
}
}),
/**
* Record cached HTTP span attributes with advice filtering to HTTP metric attributes. This
* isolates the CPU and memory allocation for applying advice vs. creating attributes.
*/
ADVICE_ALL_ATTRIBUTES_CACHED(
new Instrument() {
private LongCounter counter;
Expand Down

This file was deleted.

0 comments on commit 69f3c30

Please sign in to comment.