{"id":21001094,"url":"https://github.com/parseablehq/opentelemetry-rust-parseable","last_synced_at":"2025-04-12T06:37:25.873Z","repository":{"id":181960614,"uuid":"662690087","full_name":"parseablehq/opentelemetry-rust-parseable","owner":"parseablehq","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-16T09:49:23.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T02:02:15.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parseablehq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["parseable","operator"]}},"created_at":"2023-07-05T17:12:08.000Z","updated_at":"2024-03-06T06:30:43.000Z","dependencies_parsed_at":"2025-01-20T09:41:53.002Z","dependency_job_id":"875c909d-efad-415e-932d-ea0afe6c22c8","html_url":"https://github.com/parseablehq/opentelemetry-rust-parseable","commit_stats":null,"previous_names":["parseablehq/opentelemetry-rust-parseable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fopentelemetry-rust-parseable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fopentelemetry-rust-parseable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fopentelemetry-rust-parseable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parseablehq%2Fopentelemetry-rust-parseable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parseablehq","download_url":"https://codeload.github.com/parseablehq/opentelemetry-rust-parseable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530592,"owners_count":21119590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:13:39.089Z","updated_at":"2025-04-12T06:37:25.838Z","avatar_url":"https://github.com/parseablehq.png","language":"Rust","funding_links":["https://github.com/sponsors/parseable","https://github.com/sponsors/operator"],"categories":[],"sub_categories":[],"readme":"# Parseable OpenTelemetry Trace Exporter \n\nThis repository contains OpenTelemetry rust sdk trace exporter that allows you to collect and export traces to Parseable. The exporter can be used directly with opentelemetry crate or used as a tracing subscriber using tracing-opentelemetry.\n\n## Installation\n\nTo use this exporter in your Rust project, add the following dependency to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nopentelemetry-parseable = { git = \"https://github.com/parseablehq/opentelemetry-rust-parseable.git\"}\n```\n\n## Example\n\n### Define Resource for Tracer\n\n```rust\nuse opentelemetry::KeyValue;\nuse opentelemetry::sdk::Resource;\n// Function to create the resource with key-value pairs\nfn tracer_resource(service_name: \u0026str) -\u003e opentelemetry::sdk::Resource {\n    let kvs = [\n        KeyValue::new(\"user.real_name\", whoami::realname()),\n        KeyValue::new(\"user.user_name\", whoami::username()),\n        KeyValue::new(\"host.platform\", whoami::platform().to_string()),\n        KeyValue::new(\n            opentelemetry_semantic_conventions::resource::HOST_ARCH,\n            whoami::arch().to_string(),\n        ),\n        KeyValue::new(\n            opentelemetry_semantic_conventions::resource::SERVICE_NAME,\n            service_name,\n        ),\n        KeyValue::new(\n            opentelemetry_semantic_conventions::resource::HOST_NAME,\n            whoami::hostname(),\n        ),\n    ];\n    Resource::new(kvs)\n}\n```\n\n### Here is an example of how you can use the exporter with opentelemetry crate\n\n```rust\nuse opentelemetry::{\n    global,\n    trace::{Span, Tracer},\n};\nuse opentelemetry::{runtime, sdk::trace};\nuse tokio::time::{sleep, Duration};\n\nuse opentelemetry_parseable::ParseableExporterBuilder;\n\nconst SERVICE_NAME: \u0026str = \"my-service\";\n\n// startup function to initialize the exporter and tracing\nfn install_global_tracer() {\n    let config = trace::config().with_resource(tracer_resource(SERVICE_NAME));\n    ParseableExporterBuilder::default()\n        // service name provided here is used as the stream name in Parseable\n        .with_service_name(SERVICE_NAME)\n        .install_batch(runtime::Tokio, config)\n        .expect(\"Unable to build and install parseable exporter\");\n}\n\n// Main function to demonstrate the usage of the exporter\n#[tokio::main]\nasync fn main() {\n    install_global_tracer();\n    // get a tracer from a provider\n    let tracer = global::tracer(\"my_service\");\n    // start a new span\n    let mut span = tracer.start(\"my_span\");\n    // set some attributes\n    span.set_attribute(KeyValue::new(\"http.client_ip\", \"83.164.160.102\"));\n    // perform some more work...\n    // end or drop the span to export\n    span.end();\n    // Sleep for a while to allow some traces to be captured\n    sleep(Duration::from_secs(5)).await;\n}\n\n```\n### Here is an example of how you can use the exporter with tracing opentelemetry crate\n\n```rust\n\nuse opentelemetry::{runtime, sdk::trace};\nuse tokio::time::{sleep, Duration};\nuse tracing::*;\nuse tracing_subscriber::prelude::*;\n\nuse opentelemetry_parseable::ParseableExporterBuilder;\n\nconst SERVICE_NAME: \u0026str = \"my-service\";\n\n// startup function to initialize the exporter and tracing\nfn install_global_tracer() {\n    let config = trace::config().with_resource(tracer_resource(SERVICE_NAME));\n    // Create and install the Parseable exporter\n    let tracer = ParseableExporterBuilder::default()\n        // service name provided here is used as the stream name in Parseable\n        .with_service_name(SERVICE_NAME)\n        .install_batch(runtime::Tokio, config)\n        .expect(\"Unable to build parseable exporter\");\n\n    let collector =\n        tracing_subscriber::registry().with(tracing_opentelemetry::layer().with_tracer(tracer));\n\n    // Register the tracing subscriber globally\n    if tracing::subscriber::set_global_default(collector).is_err() {\n        eprintln!(\n            \"Error setting tracing subscriber, probably another subscriber has already been set?\"\n        );\n    }\n}\n\n#[instrument]\nasync fn bar() {\n    sleep(Duration::from_secs(1)).await;\n}\n\n#[instrument]\npub async fn foo() {\n    info!(\"Calling bar\");\n    bar().await;\n    trace!(\"bar returned\");\n}\n\n// Main function to demonstrate the usage of the exporter\n#[tokio::main]\nasync fn main() {\n    // Initialize the telemetry exporter\n    install_global_tracer();\n    foo().await;\n\n    // Sleep for a while to allow some traces to be captured\n    sleep(Duration::from_secs(5)).await;\n}\n\n```\n\n### Configuration\nIf you don't want to use builder methods to configure parseable instance to target, you can set following environment variables to configure the exporter instead\n\n| Variable | Default |\n|----|----|\n| PARSEABLE_HOST | 0.0.0.0 |\n| PARSEABLE_PORT | 8000 |\n| PARSEABLE_USERNAME | admin |\n| PARSEABLE_PASSWORD | admin |\n\nBatch exporter can be configured from environment as well \n\n\n| Variable | Default |\n|----|----|\n| OTLP_QUEUE_SIZE | 65536 |\n| OTLP_BATCH_SIZE | 8192 |\n| OTLP_INTERVAL_MILLIS | 1000 |\n\n\n## Contributing\n\nIf you encounter any issues, have suggestions, or want to contribute to the project, feel free to create an issue or submit a pull request on GitHub.\n\nHappy tracing!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparseablehq%2Fopentelemetry-rust-parseable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparseablehq%2Fopentelemetry-rust-parseable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparseablehq%2Fopentelemetry-rust-parseable/lists"}