| Crates.io | otlp-exporter |
| lib.rs | otlp-exporter |
| version | 0.1.0 |
| created_at | 2023-08-16 17:18:39.196357+00 |
| updated_at | 2023-08-16 17:18:39.196357+00 |
| description | OTLP Exporter for the OpenTelemetry Collector |
| homepage | https://github.com/fortime/otlp-exporter/tree/main |
| repository | https://github.com/fortime/otlp-exporter/tree/main |
| max_upload_size | |
| id | 946158 |
| size | 72,792 |
THIS IS A PERSONAL PROJECT. IT IS STILL IN DEVELOPMENT. USE ON YOUR OWN RISK.
An exporter exports trace, metric and log data in the OTLP format.
| protocol | trace | metric | log |
|---|---|---|---|
| grpc(tonic) | ✓ | ☐ | ☐ |
| grpc(grpcio)1 | ✓ | ☐ | ☐ |
| http/protobuf | ✓ | ☐ | ☐ |
| http/json | blocking | ☐ | ☐ |
| dep | std | provided ca | client key |
|---|---|---|---|
| tonic | not test | not test | not test |
| grpcio | not test | not test | not test |
| reqwest | not test | not test | not test |
grpc, we can use install_simple simply. It uses future_executors.use opentelemetry_api::{trace::Tracer, global, KeyValue};
use opentelemetry_sdk::Resource;
#[tokio::main]
pub async fn main() {
let tracer = match otlp_exporter::new_pipeline()
.trace()
.with_env()
.with_tracer_config(
opentelemetry_sdk::trace::config().with_resource(Resource::new(vec![KeyValue::new(
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
"otlp-exporter-example",
)])),
)
.install_simple()
{
Ok(tracer) => tracer,
Err(e) => {
println!("error: {e}");
return;
}
};
tracer.in_span("otlp-exporter trace example", |_cx| {});
global::shutdown_tracer_provider();
}
http/protocol and http/json, it depends on reqwest which depends on tokio. So, we must use install_batch with Tokio.use opentelemetry_api::{trace::Tracer, global, KeyValue};
use opentelemetry_sdk::{runtime::Tokio, Resource};
#[tokio::main]
pub async fn main() {
let tracer = match otlp_exporter::new_pipeline()
.trace()
.with_env()
.with_tracer_config(
opentelemetry_sdk::trace::config().with_resource(Resource::new(vec![KeyValue::new(
opentelemetry_semantic_conventions::resource::SERVICE_NAME,
"otlp-exporter-example",
)])),
)
.install_batch(Tokio)
{
Ok(tracer) => tracer,
Err(e) => {
println!("error: {e}");
return;
}
};
tracer.in_span("otlp-exporter trace example", |_cx| {});
global::shutdown_tracer_provider();
}
As of 2023-08-16, grpc 0.12.1 can't be compiled with gcc 13, you can patch it with its git repo. ↩