mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 20:34:54 +00:00
Removed unused struct.
This commit is contained in:
parent
568d6094b5
commit
cd62e237fe
@ -5,27 +5,6 @@ use opentelemetry::global;
|
|||||||
use opentelemetry::propagation::{Extractor, Injector};
|
use opentelemetry::propagation::{Extractor, Injector};
|
||||||
use tracing_opentelemetry::OpenTelemetrySpanExt;
|
use tracing_opentelemetry::OpenTelemetrySpanExt;
|
||||||
|
|
||||||
/// Extract context metadata from a gRPC request's metadata
|
|
||||||
struct MetadataExtractor<'a>(pub &'a tonic::metadata::MetadataMap);
|
|
||||||
|
|
||||||
impl<'a> Extractor for MetadataExtractor<'a> {
|
|
||||||
/// Get a value for a key from the MetadataMap. If the value can't be converted to &str, returns None
|
|
||||||
fn get(&self, key: &str) -> Option<&str> {
|
|
||||||
self.0.get(key).and_then(|metadata| metadata.to_str().ok())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Collect all the keys from the MetadataMap.
|
|
||||||
fn keys(&self) -> Vec<&str> {
|
|
||||||
self.0
|
|
||||||
.keys()
|
|
||||||
.map(|key| match key {
|
|
||||||
tonic::metadata::KeyRef::Ascii(v) => v.as_str(),
|
|
||||||
tonic::metadata::KeyRef::Binary(v) => v.as_str(),
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inject context in the metadata of a gRPC request.
|
/// Inject context in the metadata of a gRPC request.
|
||||||
struct MetadataInjector<'a>(pub &'a mut tonic::metadata::MetadataMap);
|
struct MetadataInjector<'a>(pub &'a mut tonic::metadata::MetadataMap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user