fn create_exit_span_with_dsn()

in src/plugin/plugin_pdo.rs [268:283]


fn create_exit_span_with_dsn(
    request_id: Option<i64>, class_name: &str, function_name: &str, dsn: &Dsn,
) -> anyhow::Result<Span> {
    RequestContext::try_with_global_ctx(request_id, |ctx| {
        let mut span =
            ctx.create_exit_span(&format!("{}->{}", class_name, function_name), &dsn.peer);

        let span_object = span.span_object_mut();
        span_object.set_span_layer(SpanLayer::Database);
        span_object.component_id = COMPONENT_PHP_PDO_ID;
        span_object.add_tag(TAG_DB_TYPE, &dsn.db_type);
        span_object.add_tag("db.data_source", &dsn.data_source);

        Ok(span)
    })
}