pub struct Langfuse { /* private fields */ }otel only.Expand description
Where traces go, and the project keys that authorise them.
Applying it with
TelemetryBuilder::with_langfuse:
- sends traces to
{base_url}/api/public/otel/v1/tracesover OTLP/HTTP with protobuf bodies — Langfuse does not accept OTLP/gRPC — withAuthorization: Basic base64(public_key:secret_key)andx-langfuse-ingestion-version: 4, which Langfuse’s documentation asks for so that directly ingested spans are not delayed; - turns metrics and logs off by default, because Langfuse discards
OTLP metrics and has no OTLP logs route.
OTEL_METRICS_EXPORTER=otlporOTEL_LOGS_EXPORTER=otlpturns them back on, towards the generalOTEL_EXPORTER_OTLP_*endpoint — a collector, not Langfuse.
The preset’s endpoint is set in code, so for traces it wins over
OTEL_EXPORTER_OTLP_ENDPOINT. Its two headers are added to those in
OTEL_EXPORTER_OTLP_HEADERS, and a header of the same name in the
variable replaces the preset’s; to send traces somewhere else, do not
apply it.
Implementations§
Source§impl Langfuse
impl Langfuse
Sourcepub fn new(
base_url: impl Into<String>,
public_key: impl Into<String>,
secret_key: impl Into<String>,
) -> Langfuse
pub fn new( base_url: impl Into<String>, public_key: impl Into<String>, secret_key: impl Into<String>, ) -> Langfuse
A project on the Langfuse at base_url — a self-hosted instance such
as LANGFUSE_SELF_HOSTED, or Langfuse Cloud
(https://cloud.langfuse.com, https://us.cloud.langfuse.com).
Sourcepub fn from_env() -> Result<Langfuse, TelemetryError>
pub fn from_env() -> Result<Langfuse, TelemetryError>
Reads LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY and
LANGFUSE_BASE_URL, the variables Langfuse’s SDKs read. The base URL
defaults to LANGFUSE_SELF_HOSTED — not to Langfuse Cloud, as
theirs does.
§Errors
TelemetryError::Config naming the key that is missing. The error
never contains a key’s value.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Langfuse
impl Freeze for Langfuse
impl Move for Langfuse
impl RefUnwindSafe for Langfuse
impl Send for Langfuse
impl Sync for Langfuse
impl Unpin for Langfuse
impl UnsafeUnpin for Langfuse
impl UnwindSafe for Langfuse
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].