the beginning of bringing benchee back
This commit is contained in:
parent
94a992ea00
commit
8a0441356d
|
|
@ -176,15 +176,16 @@ it is included the override is necessary.
|
|||
Running benchmarks is done with [benchee](https://github.com/bencheeorg/benchee). Benchmark functions are in modules under `samples/`. To run them open a rebar3 shell in the `bench` profile:
|
||||
|
||||
``` shell
|
||||
$ rebar3 as bench compile
|
||||
$ rebar3 as bench shell
|
||||
|
||||
> otel_benchmarks:run().
|
||||
```
|
||||
|
||||
If an Elixir script is wanted for the benchmarks they could be run like:
|
||||
If an Elixir script is wanted for the benchmarks they could be run like (after
|
||||
running `rebar3 as bench compile`):
|
||||
|
||||
``` shell
|
||||
$ ERL_LIBS=_build/bench/lib/ mix run --no-mix-exs samples/run.exs
|
||||
$ ERL_AFLAGS="-pa ./_build/bench/extras/samples/" ERL_LIBS=_build/bench/lib/ mix run --no-mix-exs samples/run.exs
|
||||
```
|
||||
|
||||
## W3C Trace Context Interop Tests
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
{opentelemetry,
|
||||
[{processors, [{otel_batch_processor,
|
||||
#{exporter => none}
|
||||
}]
|
||||
}]}
|
||||
].
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
[
|
||||
{opentelemetry,
|
||||
[{processors, [{otel_batch_processor,
|
||||
#{exporter => {otel_exporter_stdout, []}}
|
||||
}]
|
||||
}]}
|
||||
{opentelemetry, []}
|
||||
].
|
||||
|
|
|
|||
|
|
@ -29,9 +29,13 @@
|
|||
{extra_src_dirs, ["interop"]}]},
|
||||
|
||||
{bench, [{deps, [benchee]},
|
||||
{extra_src_dirs, ["bench"]},
|
||||
{extra_src_dirs, ["samples"]},
|
||||
{plugins, [rebar_mix]},
|
||||
{provider_hooks, [{pre, [{compile, {mix, find_elixir_libs}}]}]}]}]}.
|
||||
{provider_hooks, []},
|
||||
|
||||
{shell, [{apps, [opentelemetry,
|
||||
opentelemetry_experimental]},
|
||||
{config, "config/bench.config"}]}]}]}.
|
||||
|
||||
{xref_checks, [undefined_function_calls, undefined_functions, locals_not_used,
|
||||
deprecated_function_calls, deprecated_functions]}.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
-module(otel_benchmarks).
|
||||
|
||||
-export([run/0]).
|
||||
|
||||
-include_lib("opentelemetry_api/include/otel_tracer.hrl").
|
||||
|
||||
%% doesn't currently show anything useful
|
||||
run() ->
|
||||
PDictCtxFun = fun() ->
|
||||
?start_span(a_span),
|
||||
?end_span()
|
||||
end,
|
||||
|
||||
CtxFun = fun() ->
|
||||
Tracer = opentelemetry:get_application_tracer(?MODULE),
|
||||
SpanCtx = otel_tracer:start_span(Tracer, a_span, #{}),
|
||||
otel_span:end_span(SpanCtx)
|
||||
end,
|
||||
|
||||
benchee:run(#{<<"pdict_ctx">> => PDictCtxFun,
|
||||
<<"ctx">> => CtxFun}),
|
||||
ok.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# this file makes it possible to run the benchmarks in CI
|
||||
# with `mix run`
|
||||
|
||||
:ot_benchmarks.run()
|
||||
:otel_benchmarks.run()
|
||||
|
|
|
|||
Loading…
Reference in New Issue