mirror of
https://github.com/denoland/deno.git
synced 2025-01-20 20:42:19 -05:00
otel: support https
This commit is contained in:
parent
4f27d7cdc0
commit
7d6e62c073
3 changed files with 20 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2421,8 +2421,10 @@ dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"deno_core",
|
"deno_core",
|
||||||
"deno_error",
|
"deno_error",
|
||||||
|
"deno_tls",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper 1.4.1",
|
"hyper 1.4.1",
|
||||||
|
"hyper-rustls",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
|
@ -17,8 +17,10 @@ path = "lib.rs"
|
||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
deno_core.workspace = true
|
deno_core.workspace = true
|
||||||
deno_error.workspace = true
|
deno_error.workspace = true
|
||||||
|
deno_tls.workspace = true
|
||||||
http-body-util.workspace = true
|
http-body-util.workspace = true
|
||||||
hyper.workspace = true
|
hyper.workspace = true
|
||||||
|
hyper-rustls.workspace = true
|
||||||
hyper-util.workspace = true
|
hyper-util.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
once_cell.workspace = true
|
once_cell.workspace = true
|
||||||
|
|
|
@ -475,10 +475,14 @@ mod hyper_client {
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use std::task::{self};
|
use std::task::{self};
|
||||||
|
|
||||||
|
use deno_tls::create_client_config;
|
||||||
|
use deno_tls::SocketUse;
|
||||||
|
use deno_tls::TlsKeys;
|
||||||
use http_body_util::BodyExt;
|
use http_body_util::BodyExt;
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use hyper::body::Body as HttpBody;
|
use hyper::body::Body as HttpBody;
|
||||||
use hyper::body::Frame;
|
use hyper::body::Frame;
|
||||||
|
use hyper_rustls::HttpsConnector;
|
||||||
use hyper_util::client::legacy::connect::HttpConnector;
|
use hyper_util::client::legacy::connect::HttpConnector;
|
||||||
use hyper_util::client::legacy::Client;
|
use hyper_util::client::legacy::Client;
|
||||||
use opentelemetry_http::Bytes;
|
use opentelemetry_http::Bytes;
|
||||||
|
@ -492,13 +496,23 @@ mod hyper_client {
|
||||||
// same as opentelemetry_http::HyperClient except it uses OtelSharedRuntime
|
// same as opentelemetry_http::HyperClient except it uses OtelSharedRuntime
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HyperClient {
|
pub struct HyperClient {
|
||||||
inner: Client<HttpConnector, Body>,
|
inner: Client<HttpsConnector<HttpConnector>, Body>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HyperClient {
|
impl HyperClient {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
let tls_config = create_client_config(
|
||||||
|
None,
|
||||||
|
vec![],
|
||||||
|
None,
|
||||||
|
TlsKeys::Null,
|
||||||
|
SocketUse::Http,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let http_connector = HttpConnector::new();
|
||||||
|
let connector = HttpsConnector::from((http_connector, tls_config));
|
||||||
Self {
|
Self {
|
||||||
inner: Client::builder(OtelSharedRuntime).build(HttpConnector::new()),
|
inner: Client::builder(OtelSharedRuntime).build(connector),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue