opentelemetry-rust/opentelemetry-stdout
Cijo Thomas a612972c20
SpanAttributes modified to use Vec instead of OrderMap/EvictedHashMap (#1293)
* Use Vec for span attributes instead of HashMaps

* fix bench

* revert

* add dropped_attributes_count back

* fix more exporters

* fix datadog exporter

* fix stackdriver exporter

* fix changelogs

* fix doc

* fix lint and other issues

* more fix

* more fixes

* fix clippy

* add comment

* refix test

* ignore dd tests

* fmt

* tests added

* fix comment and tes

* fmr
2023-10-20 10:21:56 -07:00
..
examples Change opentelemetry crate to contain only the API, not the SDK #1186 (#1199) 2023-08-23 21:01:28 -07:00
src SpanAttributes modified to use Vec instead of OrderMap/EvictedHashMap (#1293) 2023-10-20 10:21:56 -07:00
CHANGELOG.md Stdout to print temporality in user readable format (#1260) 2023-09-09 12:43:48 -04:00
CODEOWNERS Create opentelemetry-stdout (#1027) 2023-04-23 11:06:32 -07:00
Cargo.toml Upgrade dependencies (#1279) 2023-10-05 13:17:22 -04:00
LICENSE Adding Copyright Holders (#1112) 2023-06-16 11:39:25 -07:00
README.md Change opentelemetry crate to contain only the API, not the SDK #1186 (#1199) 2023-08-23 21:01:28 -07:00

README.md

OpenTelemetry — An observability framework for cloud-native software.

OpenTelemetry Stdout

Exporters for applications instrumented with OpenTelemetry.

Crates.io: opentelemetry-stdout Documentation LICENSE GitHub Actions CI Slack

Overview

OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior. This crate provides exporters that export to stdout or any implementation of std::io::Write.

Compiler support: requires rustc 1.64+

Quickstart

Export telemetry signals to stdout.

use opentelemetry::{
    metrics::MeterProvider as _,
    trace::{Span, Tracer, TracerProvider as _},
    Context, KeyValue,
};
use opentelemetry_sdk::{
    metrics::{MeterProvider, PeriodicReader},
    runtime,
    trace::{BatchSpanProcessor, TracerProvider},
};

fn init_trace() -> TracerProvider {
    let exporter = opentelemetry_stdout::SpanExporter::default();
    let processor = BatchSpanProcessor::builder(exporter, runtime::Tokio).build();
    TracerProvider::builder()
        .with_span_processor(processor)
        .build()
}

fn init_metrics() -> MeterProvider {
    let exporter = opentelemetry_stdout::MetricsExporter::default();
    let reader = PeriodicReader::builder(exporter, runtime::Tokio).build();
    MeterProvider::builder().with_reader(reader).build()
}

let tracer_provider = init_trace();
let meter_provider = init_metrics();

Recorded traces and metrics will now be sent to stdout:

{"resourceMetrics":{"resource":{"attributes":[{"key":"service.name","value":{"str..
{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stri..

Supported Rust Versions

OpenTelemetry is built against the latest stable release. The minimum supported version is 1.64. The current OpenTelemetry version is not guaranteed to build on Rust versions earlier than the minimum supported version.

The current stable Rust compiler and the three most recent minor versions before it will always be supported. For example, if the current stable compiler version is 1.49, the minimum supported version will not be increased past 1.46, three minor versions prior. Increasing the minimum supported compiler version is not considered a semver breaking change as long as doing so complies with this policy.