wingfoil-python 4.0.1

python bindings for wingfoil - graph based stream processing framework
Documentation
//! Python bindings for the otlp adapter.

use crate::PyNode;
use crate::py_stream::PyStream;
use pyo3::prelude::*;
use wingfoil::StreamOperators;
use wingfoil::adapters::otlp::{OtlpConfig, OtlpPush};

/// Inner implementation for the `.otlp_push()` stream method.
pub fn py_otlp_push_inner(
    stream: &PyStream,
    metric_name: String,
    endpoint: String,
    service_name: String,
) -> PyNode {
    let config = OtlpConfig {
        endpoint,
        service_name,
    };
    let str_stream = stream.0.map(|elem| {
        Python::attach(|py| {
            elem.as_ref()
                .bind(py)
                .str()
                .map(|s| s.to_string())
                .unwrap_or_default()
        })
    });
    PyNode::new(str_stream.otlp_push(&metric_name, config))
}