В статье рассмотрено, как использовать OpenTelemetry в Rust для мониторинга и трассировки приложений. OpenTelemetry — это мощный инструмент для сбора и анализа данных о производительности, который помогает отслеживать выполнение запросов в распределенных системах.
В статье показано, как интегрировать OpenTelemetry в приложение на Rust, используя библиотеку tracing и экспортировать данные в Jaeger. Приведены примеры кода, объясняющие настройку и использование трейсов для диагностики проблем и улучшения производительности.
Базовый конвейер с OpenTelemetry можно настроить с помощью opentelemetry_otlp. Затем создаётся слой tracing_opentelemetry, использующий этот конвейер, и добавляется в подписчик трассировки, который инициализируется.
// note that here, localhost:4318 is the default HTTP address // for a local OpenTelemetry collector let tracer = opentelemetry_otlp ::new_pipeline() .tracing() .with_exporter(opentelemetry_otlp::new_exporter().http().with_endpoint("localhost:4318")) .install_batch(Tokio) .unwrap();
// log level filtering here let filter_layer = EnvFilter::try_from_default_env() .or_else(|_| EnvFilter::try_new("info")) .unwrap();
// fmt layer - printing out logs let fmt_layer = fmt::layer().compact();
// turn our OTLP pipeline into a tracing layer let otel_layer = tracing_opentelemetry::layer().with_tracer(tracer);
// initialise our subscriber subscriber .with(filter_layer) .with(fmt_layer) .with(otel_layer) // The error layer needs to go after the otel_layer, because it needs access to the // otel_data extension that is set on the span in the otel_layer. .with(ErrorTracingLayer::new()) .init();
В статье рассмотрено, как использовать OpenTelemetry в Rust для мониторинга и трассировки приложений. OpenTelemetry — это мощный инструмент для сбора и анализа данных о производительности, который помогает отслеживать выполнение запросов в распределенных системах.
В статье показано, как интегрировать OpenTelemetry в приложение на Rust, используя библиотеку tracing и экспортировать данные в Jaeger. Приведены примеры кода, объясняющие настройку и использование трейсов для диагностики проблем и улучшения производительности.
Базовый конвейер с OpenTelemetry можно настроить с помощью opentelemetry_otlp. Затем создаётся слой tracing_opentelemetry, использующий этот конвейер, и добавляется в подписчик трассировки, который инициализируется.
// note that here, localhost:4318 is the default HTTP address // for a local OpenTelemetry collector let tracer = opentelemetry_otlp ::new_pipeline() .tracing() .with_exporter(opentelemetry_otlp::new_exporter().http().with_endpoint("localhost:4318")) .install_batch(Tokio) .unwrap();
// log level filtering here let filter_layer = EnvFilter::try_from_default_env() .or_else(|_| EnvFilter::try_new("info")) .unwrap();
// fmt layer - printing out logs let fmt_layer = fmt::layer().compact();
// turn our OTLP pipeline into a tracing layer let otel_layer = tracing_opentelemetry::layer().with_tracer(tracer);
// initialise our subscriber subscriber .with(filter_layer) .with(fmt_layer) .with(otel_layer) // The error layer needs to go after the otel_layer, because it needs access to the // otel_data extension that is set on the span in the otel_layer. .with(ErrorTracingLayer::new()) .init();
“To the extent it is used I fear it’s often for illicit finance. It’s an extremely inefficient way of conducting transactions, and the amount of energy that’s consumed in processing those transactions is staggering,” the former Fed chairwoman said. Yellen’s comments have been cited as a reason for bitcoin’s recent losses. However, Yellen’s assessment of bitcoin as a inefficient medium of exchange is an important point and one that has already been raised in the past by bitcoin bulls. Using a volatile asset in exchange for goods and services makes little sense if the asset can tumble 10% in a day, or surge 80% over the course of a two months as bitcoin has done in 2021, critics argue. To put a finer point on it, over the past 12 months bitcoin has registered 8 corrections, defined as a decline from a recent peak of at least 10% but not more than 20%, and two bear markets, which are defined as falls of 20% or more, according to Dow Jones Market Data.
How Does Bitcoin Work?
Bitcoin is built on a distributed digital record called a blockchain. As the name implies, blockchain is a linked body of data, made up of units called blocks that contain information about each and every transaction, including date and time, total value, buyer and seller, and a unique identifying code for each exchange. Entries are strung together in chronological order, creating a digital chain of blocks. “Once a block is added to the blockchain, it becomes accessible to anyone who wishes to view it, acting as a public ledger of cryptocurrency transactions,” says Stacey Harris, consultant for Pelicoin, a network of cryptocurrency ATMs. Blockchain is decentralized, which means it’s not controlled by any one organization. “It’s like a Google Doc that anyone can work on,” says Buchi Okoro, CEO and co-founder of African cryptocurrency exchange Quidax. “Nobody owns it, but anyone who has a link can contribute to it. And as different people update it, your copy also gets updated.”