Skip to content

Commit dd2770e

Browse files
committed
Revert "Add src/middleware/lambda/value.rs"
This reverts commit 34aa552.
1 parent e59d599 commit dd2770e

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

src/middleware/lambda/context.rs

+30-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
11
use crate::semconv;
22
use lambda_runtime::LambdaInvocation;
3-
use opentelemetry::trace::SpanKind;
3+
use opentelemetry::{trace::SpanKind, StringValue};
44
use opentelemetry_sdk::trace::TracerProvider;
55
use tracing::Span;
66
use tracing_opentelemetry_instrumentation_sdk::TRACING_TARGET;
77

8-
use super::{
9-
value::{OptionalValue, Value},
10-
OtelLambdaLayer,
11-
};
8+
use super::OtelLambdaLayer;
129

1310
pub trait LambdaServiceContext {
1411
fn create_span(&self, req: &LambdaInvocation, coldstart: bool) -> Span;
1512
}
1613

14+
pub struct Value(StringValue);
15+
16+
impl Value {
17+
pub fn as_str(&self) -> &str {
18+
self.0.as_str()
19+
}
20+
}
21+
22+
impl<T: Into<StringValue>> From<T> for Value {
23+
fn from(inner: T) -> Self {
24+
Self(inner.into())
25+
}
26+
}
27+
28+
pub struct OptionalValue(Option<StringValue>);
29+
30+
impl OptionalValue {
31+
pub fn as_str(&self) -> Option<&str> {
32+
self.0.as_ref().map(|value| value.as_str())
33+
}
34+
}
35+
36+
impl<T: Into<StringValue>> From<Option<T>> for OptionalValue {
37+
fn from(inner: Option<T>) -> Self {
38+
Self(inner.map(|value| value.into()))
39+
}
40+
}
41+
1742
macro_rules! lambda_service {
1843
($trigger: ident, $kind: ident, $service:ident { $($prop:ident: $type:ty,)* }$(, $($field:tt)*)?) => {
1944
#[allow(non_snake_case)]

src/middleware/lambda/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub mod context;
22
pub mod layer;
3-
pub mod value;
43

54
pub use layer::OtelLambdaLayer;

src/middleware/lambda/value.rs

-23
This file was deleted.

0 commit comments

Comments
 (0)