Skip to content
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

Invert and rename telemetry argument #784

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ tikv-jemallocator = "0.6.0"
env_logger = "0.11.5"
log = "0.4.20"
fastrace = { version = "0.7.4", features = ["enable"] }
fastrace-opentelemetry = { version = "0.8.0" }
opentelemetry-otlp = "0.27.0"
opentelemetry = "0.27.0"
opentelemetry_sdk = "0.27.1"
fastrace-opentelemetry = { version = "0.9.0" }
opentelemetry-otlp = { version = "0.28.0", features = ["grpc-tonic"] }
opentelemetry = "0.28.0"
opentelemetry_sdk = "0.28.0"

[features]
logger = ["firewood/logger"]
13 changes: 13 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,16 @@ If you're looking for detailed logging, there are some command line options to e
```sh
cargo run --profile release --bin benchmark -- -l debug -n 10000 single
```

# Using opentelemetry

To use the opentelemetry server and record timings, just run a docker image that collects the data using:

```sh
docker run -p 127.0.0.1:4318:4318 -p 127.0.0.1:55679:55679 otel/opentelemetry-collector-contrib:0.97.0 2>&1
```

Then, pass the `-e` option to the benchmark.
```

Then, pass the `-e` option to the benchmark.
24 changes: 14 additions & 10 deletions benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ use fastrace::collector::Config;

use opentelemetry::trace::SpanKind;
use opentelemetry::InstrumentationScope;
use opentelemetry::KeyValue;
use opentelemetry_otlp::SpanExporter;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_otlp::{SpanExporter, WithExportConfig};
use opentelemetry_sdk::Resource;

#[derive(Parser, Debug)]
struct Args {
#[arg(short = 't', long, default_value_t = false)]
no_telemetry_server: bool,
#[arg(
short = 'e',
long,
default_value_t = false,
help = "Enable telemetry server reporting"
)]
telemetry_server: bool,
#[arg(short, long, default_value_t = 10000)]
batch_size: u64,
#[arg(short, long, default_value_t = 1000)]
Expand Down Expand Up @@ -145,7 +148,7 @@ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
async fn main() -> Result<(), Box<dyn Error>> {
let args = Args::parse();

if !args.no_telemetry_server {
if args.telemetry_server {
let reporter = OpenTelemetryReporter::new(
SpanExporter::builder()
.with_tonic()
Expand All @@ -157,10 +160,11 @@ async fn main() -> Result<(), Box<dyn Error>> {
.build()
.expect("initialize oltp exporter"),
SpanKind::Server,
Cow::Owned(Resource::new([KeyValue::new(
"service.name",
"avalabs.firewood.benchmark",
)])),
Cow::Owned(
Resource::builder()
.with_service_name("avalabs.firewood.benchmark")
.build(),
),
InstrumentationScope::builder("firewood")
.with_version(env!("CARGO_PKG_VERSION"))
.build(),
Expand Down