NAME

Langertha::Knarr::Handler::Tracing - Decorator handler that records every request as a Langfuse trace

VERSION

version 1.001

SYNOPSIS

use Langertha::Knarr::Tracing;
use Langertha::Knarr::Handler::Tracing;

my $tracing = Langertha::Knarr::Tracing->new(config => $config);
$handler = Langertha::Knarr::Handler::Tracing->new(
    wrapped => $handler,
    tracing => $tracing,
);

DESCRIPTION

Decorator handler that opens a Langfuse trace + generation around every chat or stream request and closes it with the assistant text once the inner handler resolves (or fails). Streaming requests accumulate every delta into a single output before closing the trace, so the Langfuse view shows the full assembled response.

knarr start mounts this automatically when the config supplies Langfuse credentials.

wrapped

Required. The inner Langertha::Knarr::Handler being decorated. The attribute is named wrapped rather than inner because Moose imports an inner() keyword used for augmented methods.

tracing

Required. A Langertha::Knarr::Tracing instance (or any object implementing start_trace / end_trace).

engine_label

Optional. A string injected into the trace metadata's engine field. Defaults to ref($self->wrapped).

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.