Commit Graph

34 Commits

Author SHA1 Message Date
Shaun Cox 759556d590
Change opentelemetry crate to contain only the API, not the SDK #1186 (#1199) 2023-08-23 21:01:28 -07:00
Julian Tescher 41e8d63652
Add `grpcio` metrics exporter (#1202)
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-08-14 18:18:47 -07:00
Julian Tescher e12247e9ca
Rename `traces` feature to the more standard `trace` (#1183) 2023-08-03 09:50:58 -07:00
Zhongyang Wu e773f92263
chore: clean up examples (#1094)
* chore: move examples to their integrations

* merge upstream

* chore: remove examples

* fix: add `--all-features` to test script
2023-06-12 22:41:57 -07:00
Dirkjan Ochtman af21beab84
Update some dependencies (#969)
* Update some dependencies

* chore(otlp, stackdriver): add msrv in stackdriver. Update OTLP dependencies.

* chore(jaeger): update jaeger's dependencies

* chore: bump MSRV to 1.60. (#2)

Tonic 0.8 requires MSRV > 1.60

---------

Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
2023-03-08 20:01:34 -08:00
Zhongyang Wu a5d80bdbf1
chore(common): bumpe MSRV to 1.57 (#953)
* chore(common): bump MSRV to 1.57

* test(semcov): fix doc tests

* test(trace): add unit test for jaeger remote sampler.

* additional line for EOF
2023-01-24 14:56:23 -08:00
Zhongyang Wu 904329051d
fix(common): 1.65 clippy issue (#911)
- fix new clippy issues with 1.65
- Update generate files
- Update `patch_dependencies.sh`. `cargo update` now automatically downgrade the `time` create a compatible version.
- Remove `--verbose` in `cargo test` in `msrv`
2022-11-07 20:59:27 -08:00
Zhongyang Wu d571b24ad1
feat(proto): remove build script and generate files using unit tests. (#881) 2022-09-30 12:07:51 -07:00
Julian Tescher ffe1fbbe62
Fix span processor exporting unsampled spans (#871)
Currently span processors will send span data to exporters even if the
sampled flag is false. This patch fixes this by explicitly checking the
sampled state in both the batch and simple span processors.
2022-09-06 10:52:47 -07:00
Zhongyang Wu 9ea1ee77af
chore(common): bump MSRV to 1.56 (#866)
* chore(common): bump MSRV to 1.56

* chore(common): bump edition to 2021

* fix(jaeger): clippy issue

* fix: patch_depencencies.sh -> patch_dependencies.sh
2022-09-01 00:36:37 -07:00
Tomek Karwowski 399404d9b3
feat: implementation of collector http client with pure hyper (#853) 2022-08-08 08:04:52 -07:00
Zhongyang Wu b3e6e6a1f1
chore(jaeger): add integration tests to github action. (#835) 2022-07-12 09:50:45 -07:00
Joe Wilm 75348915b5
Support concurrent exports (#781)
* Add support for concurrent exports

Applications generating significant span volume can end up dropping data
due to the synchronous export step. According to the opentelemetry spec,

    This function will never be called concurrently for the same exporter
    instance. It can be called again only after the current call returns.

However, it does not place a restriction on concurrent I/O or anything
of that nature. There is an [ongoing discussion] about tweaking the
language to make this more clear.

With that in mind, this commit makes the exporters return a future that
can be spawned concurrently. Unfortunately, this means that the
`export()` method can no longer be async while taking &mut self. The
latter is desirable to enforce the no concurrent calls line of the spec,
so the choice is made here to return a future instead with the lifetime
decoupled from self. This resulted in a bit of additional verbosity, but
for the most part the async code can still be shoved into an async fn
for the ergonomics.

The main exception to this is the `jaeger` exporter which internally
requires a bunch of mutable references. I plan to discuss with the
opentelemetry team the overall goal of this PR and get buy-in before
making more invasive changes to support this in the jaeger exporter.

[ongoing discussion]: https://github.com/open-telemetry/opentelemetry-specification/issues/2434

* SpanProcessor directly manages concurrent exports

Prior, export tasks were run in "fire and forget" mode with
runtime::spawn. SpanProcessor now manages tasks directly using
FuturesUnordered. This enables limiting overall concurrency (and thus
memory footprint). Additionally, flush and shutdown logic now spawn an
additional task for any unexported spans and wait on _all_ outstanding
tasks to complete before returning.

* Add configuration for BSP max_concurrent_exports

Users may desire to control the level of export concurrency in the batch
span processor. There are two special values:

    max_concurrent_exports = 0: no bound on concurrency
    max_concurrent_exports = 1: no concurrency, makes everything
    synchronous on the messaging task.

* Implement new SpanExporter API for Jaeger

Key points
- decouple exporter from uploaders via channel and spawned task
- some uploaders are a shared I/O resource and cannot be multiplexed
    - necessitates a task queue
    - eg, HttpClient will spawn many I/O tasks internally, AgentUploader
      is a single I/O resource. Different level of abstraction.
- Synchronous API not supported without a Runtime argument. I updated
  the API to thread one through, but maybe this is undesirable. I'm also
  exploiting the fact in the Actix examples that it uses Tokio under the
  hood to pass through the Tokio runtime token.
- Tests pass save for a couple of flakey environment ones which is
  likely a race condition.

* Reduce dependencies on futures

The minimal necessary futures library (core, util, futures proper) is
now used in all packages touched by the concurrent exporters work.

* Remove runtime from Jaeger's install_simple

To keep the API _actually_ simple, we now leverage a thread to run the
jaeger exporter internals.

* Add Arc lost in a rebase

* Fix OTEL_BSP_MAX_CONCURRENT_EXPORTS name and value

Per PR feedback, the default should match the previous behavior of 1
batch at a time.

* Fix remaining TODOs

This finishes the remaining TODOs on the concurrent-exports branch. The
major change included here adds shutdown functionality to the jaeger
exporter which ensures the exporter has finished its tasks before
exiting.

* Restore lint.sh script

This was erroneously committed.

* Make max concurrent exports env configurable

OTEL_BSP_MAX_CONCURRENT_EXPORTS may now be specified in the environment
to configure the number of max concurrent exports. This configurable now
has parity with the other options of the span_processor.
2022-05-16 21:56:00 -04:00
Zhongyang Wu 07047936b4
feat(jaeger): better configuration pipeline. (#748)
* feat(jaeger): better configuration pipeline.

- Separate agent pipeline and collector pipeline. it's now `new_agent_pipeline` and `new_collector_pipeline`
- Add `Configurable` trait to include common attributes shared by agent pipeline and collector pipeline.
- Removed `with_tag` method.
- Make build in http client additive. `surf_collector_client`, `isahc_collector_client`, etc. are now just allow user to choose the http client.

* fix(jaeger): Move CommonConfig and HasRequiredConfig to private mod to meet MSRV requirement. Rename CommonConfig to TransformationConfig.

* chore: make format happy.

* chore: make msrv happy.

* test: add unit tests.

* refactor(jaeger): removed the `Configurable` trait

* fix(jaeger): fix code link
2022-03-13 14:36:35 -04:00
Zhongyang Wu 5f1bd35d08
test(jaeger): setup integration tests for jaeger (#739)
* test(jaeger): add integration test for opentelemtry jaeger

* chore(jaeger): ignore testing harness in code coverage.

* chore(common): add opentelemetry-api and opentelemetry-sdk to coverage.
2022-02-20 13:02:43 -05:00
Zhongyang Wu aee4249484
docs(proto): add documentation, guard generated types using features (#732)
* docs(proto): add documentation, guard generated types using features

* docs(proto): add doc_auto_cfg.
2022-02-13 15:06:57 -05:00
Zhongyang Wu 77c0f039f3
[proto] add opentelemetry-proto crates (#710)
* proto: add opentelemetry-proto crate.

Separate generated proto definitions and it's transformation with types in opentelemety into a new crate.

* proto: fix tests.

* proto: add features in proto

* proto: merge upstream

* refactor(otlp,proto): Clean up features and imports

- add the `grpc-tonic` feature
- add the `build-server` feature
- reordered imports in otlp

BREAKING CHANGE: add the `grpc-tonic` feature

* refactor(otlp,proto): remove prost generated files

We can just use tonic generated types without clients.

* refactor(otlp,proto): update submodule

* refactor(otlp): guard trace related code using trace feature

* docs(proto): add proto docs

* feature(proto): update proto version

Update proto version to 0.9. See https://github.com/open-telemetry/opentelemetry-proto/tree/v0.9.0

* refactor(all): merge upstream

* style(all): add one line at the end of files

* fix(examples): fix external-otlp-grpcio-async-std example

Use the new `trace` feature
2022-01-28 17:14:58 -08:00
Filip Kieres 02ddf1b9ea
Add opentelemetry-dynatrace crate (#679)
* chore: update the NoHttpClient error message

Adds a hint to the error message to make it better understandable to users how to resolve the error

* chore: Use fully qualified stream import (metrics)

* Add opentelemetry-dynatrace crate
2022-01-07 12:06:20 -05:00
Julian Tescher dc7d81fdfa
Update trace flags to match spec (#565)
Remove all trace flags except `sampled` as that is the only supported
flag in the current trace spec. Removes `SpanContext::is_deferred` and
`SpanContex::is_debug` as they are also no longer supported.
2021-06-07 11:25:10 -07:00
Julian Tescher b84f993ace
Remove default surf features (#546)
Remove default surf features, allowing users to select which features
they want to use.
2021-05-09 14:16:53 -07:00
Dan Rusei 7e88009bc4
adding otlp http transport, using proto binary (#516) 2021-04-20 11:54:20 -07:00
Jan Kühle cb419bb9f1
Configure async runtime in Rust code instead of cargo feature (#481)
Configure the async runtime (Tokio, async-std, ...) in Rust using
`with_runtime(runtime)` on the trace pipeline builders instead of using
cargo features.

The main advantages of using Rust code is that cargo doesn't have a way
of describing mutually exclusive features at the moment. We currently
fall back to Tokio if multiple runtime features are enabled. This can be
confusing, especially if a runtime feature is enabled by another crate.

Choosing the runtime in Rust code means the entire trace pipeline
configuration is in one place.
2021-03-20 21:23:12 -07:00
Zhongyang Wu e9ef3e23d6
feat: clean up lint.sh, use API to set grpc layer (#467)
`tonic` and `grpcio` take different approaches in serializing and sending spans. This change use an enum to represent the two grpc layers. If users want to bring their own grpc layer, they can implement `TracerExporter` and `SpanExporter` and then install it.
2021-03-15 10:02:14 -07:00
Zhongyang Wu c697b58008
Remove tracer provider guard. (#444)
This adds a suite of tests to ensure the global tracer provider shuts down properly using different runtimes. For optimal performance it is often preferable to spawn shutdown tasks using `tokio::spawn` instead of `tokio::spawn_blocking`, but in order to have a consistent API between blocking and non-blocking programs, then shutdown code will block on some tasks. This can cause deadlocks with single-threaded runtimes, the current solution is to spawn the background task in a separate thread if single threaded runtime features are present.
2021-02-27 11:23:33 -08:00
Dirkjan Ochtman 1bfaef0b7c
Minimal dependencies (#413) 2021-01-04 16:07:40 -08:00
Zhongyang Wu 8353ee2525
Switch Jaeger collectors to use http client trait. (#378) 2020-12-10 19:27:23 -08:00
Filip ea61575aa6
Add tonic for opentelemetry-otlp (#352)
Add support for the [tonic](https://github.com/hyperium/tonic) implementation of the gRPC transport layer to `opentelemetry-otlp`.

- Use tonic as the underlying gRPC transport layer (default)
- Optional: TLS support using rustls
- Optional: Use the platform's native certificate store
- Optional: Use an async client
2020-12-04 19:20:52 -08:00
Dirkjan Ochtman f9e91e719c
Move opentelemetry crate into a directory to flatten the workspace (#324)
This makes working with cargo easier, because many commands (like cargo
check, cargo test) will apply to all crates by default, rather than
only selecting the crate in the top-level directory.
2020-11-01 12:35:57 -08:00
Raphael Taylor-Davies 5c64f663b7
Add datadog exporter (#216) (#222) 2020-09-24 12:15:59 -07:00
Chen Yixiao 3a7439925b
Move experimental features to separate folder (#134) 2020-06-16 14:47:47 -07:00
Julian Tescher 2c687c574f
Simplify global impl and add documentation (#79)
This patch simplifies the global module by implementing
`GenericProvider` and `GenericTracer` on impls of `Provider` and
`Tracer` directly. These changes remove multiple levels of boxing that
were necessary with the previous implementation.
2020-03-23 21:11:04 -07:00
xd009642 07ad1e6faa
Add base64 conversion traits (#81)
* Add base64 conversion traits

Co-authored-by: Julian Tescher <jatescher@gmail.com>
2020-03-21 11:33:45 -07:00
James O. D. Hunt a0e8f0b63a
features: Add "serialize" feature (#59)
Added optional `serialize` feature that allows `SpanData` to be
serialized/deserialized using the `serde` crate.

Also added a basic unit test for `SpanData` to test serialization and
deserialization.

Fixes: #58.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-01-31 11:16:21 -08:00
Isobel Redelmeier b793cc502e
Configure CI through GitHub Actions (#19)
[Closes #10]
2019-12-02 13:20:40 -08:00