aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/servers/httpsys.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-01-19 13:39:03 +0100
committerGitHub Enterprise <[email protected]>2026-01-19 13:39:03 +0100
commitee0c0810b5720a01318a0115da68760b20059459 (patch)
treebcd25a41a639b487b9375830ee5e1e0d0c0cf9b6 /src/zenhttp/servers/httpsys.cpp
parentsmall doc updates (#715) (diff)
downloadzen-ee0c0810b5720a01318a0115da68760b20059459.tar.xz
zen-ee0c0810b5720a01318a0115da68760b20059459.zip
OTLP/trace improvements (#717)
This PR brings over some changes made to avoid performing setup for otel instrumentation if we are not sending otel information anywhere anyway. It also adds the ability to configure an OTLP endpoint on the command line using `--otlp-endpoint=<URI>`. Bear in mind that OTLP support is still not officially supported so this should not be used in production at this stage.
Diffstat (limited to 'src/zenhttp/servers/httpsys.cpp')
-rw-r--r--src/zenhttp/servers/httpsys.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/zenhttp/servers/httpsys.cpp b/src/zenhttp/servers/httpsys.cpp
index c555a39b6..54cc0c22d 100644
--- a/src/zenhttp/servers/httpsys.cpp
+++ b/src/zenhttp/servers/httpsys.cpp
@@ -1647,9 +1647,9 @@ HttpSysTransaction::InvokeRequestHandler(HttpService& Service, IoBuffer Payload)
std::string_view Verb = ToString(ThisRequest.RequestVerb());
std::string_view Uri = ThisRequest.m_UriUtf8.ToView();
- ExtendableStringBuilder<64> SpanName;
- SpanName << Verb << " " << Uri;
- otel::ScopedSpan HttpSpan(SpanName.ToView(), [&](otel::Span& Span) {
+ auto SpanNamer = [&](StringBuilderBase& SpanName) { SpanName << Verb << " " << Uri; };
+
+ auto SpanAnnotator = [&](otel::Span& Span) {
Span.AddAttribute("http.request.method"sv, Verb);
Span.AddAttribute("url.path"sv, Uri);
// FIXME: should be total size including headers etc according to spec
@@ -1661,7 +1661,9 @@ HttpSysTransaction::InvokeRequestHandler(HttpService& Service, IoBuffer Payload)
ExtendableStringBuilder<64> ClientAddr;
GetAddressString(ClientAddr, SockAddr, /* IncludePort */ false);
Span.AddAttribute("client.address"sv, ClientAddr.ToView());
- });
+ };
+
+ otel::ScopedSpan HttpSpan(SpanNamer, SpanAnnotator);
# endif
if (!HandlePackageOffers(Service, ThisRequest, m_PackageHandler))