Skip to content

Support "http" protocol #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 78 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ opentelemetry = { version = "0.21.0", default-features = false, features = [
"trace",
] }
tracing-opentelemetry = "0.22"
opentelemetry-http = "0.10.0"
opentelemetry-http = { version = "0.10.0", optional = true, features = ["hyper", "tokio"] }
opentelemetry-otlp = { version = "0.14", optional = true, features = ["http-proto"] }
opentelemetry-zipkin = { version = "0.19", features = [], optional = true }
opentelemetry_sdk = { version = "0.21", default-features = false, features = [
Expand All @@ -34,21 +34,23 @@ tower = { version = "0.4", optional = true }
axum = { version = "0.7.4", optional = true }
pin-project-lite = { version = "0.2", optional = true }
futures-util = { version = "0.3", default_features = false, features = [], optional = true }
hyper = { version = "1.1.0", default-features = false, features = ["http1", "client"], optional = true }
hyper = { version = "0.14", default-features = false, features = ["http1", "client"], optional = true }
hyper-v1 = { package = "hyper", version = "1.1", default-features = false, features = ["http1", "client"], optional = true }
Comment on lines +37 to +38
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opentelemetry-http uses [email protected] and it's not really compatible with the latest one.

And we need hyper@1 for out test setup, but this one is hidden behind test feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should add an http feature and hide opentelemetry-http and hyper behind it.

But it will complicate protocol detection quite a lot since we'll have to insert a lot of cfg macros to handle cases when http support is disabled.

Copy link

@Travispersson Travispersson Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might take some time for hyper 1.x support and progress can be followed here open-telemetry/opentelemetry-rust#1427

Copy link
Collaborator Author

@lbeschastny lbeschastny Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like it.

I even tried to implement my own HyperClient for the latest hyper version, but it didn't work since new hyper uses http@1, but opentelemetry-http is written on top of [email protected] and http@0.

http-body-util = { version = "0.1.0", optional = true }

[dev-dependencies]
assert2 = "0.3"
rstest = "0.18"

[features]
full = ["integration_test"]
full = ["test"]
default = ["otlp", "zipkin"]
zipkin = ["dep:opentelemetry-zipkin"]
otlp = ["opentelemetry-otlp/http-proto", "tracer", "dep:tracing-opentelemetry-instrumentation-sdk"]
otlp = ["opentelemetry-otlp/http-proto", "tracer", "dep:tracing-opentelemetry-instrumentation-sdk", "dep:opentelemetry-http", "dep:hyper"]
tracer = ["dep:opentelemetry-semantic-conventions"]
integration_test = ["axum", "dep:serde", "dep:serde_json", "dep:opentelemetry_api", "dep:rand", "dep:hyper", "dep:http-body-util"]
test = ["axum", "dep:serde", "dep:serde_json", "dep:opentelemetry_api", "dep:rand", "dep:hyper"]
axum = ["dep:axum", "dep:tower", "dep:futures-util", "dep:pin-project-lite", "dep:tracing-opentelemetry-instrumentation-sdk"]
hyper-v1 = ["dep:hyper-v1", "dep:http-body-util"]

[profile.dev]
lto = false
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use tracing_opentelemetry_instrumentation_sdk;
#[cfg(feature = "otlp")]
pub mod otlp;

#[cfg(feature = "integration_test")]
#[cfg(feature = "test")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I should rename this, but it's only used by profiles right now, so it should be fine

pub mod test;

mod filter;
Expand Down
Loading