aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-10-22 17:57:29 +0200
committerGitHub Enterprise <[email protected]>2025-10-22 17:57:29 +0200
commit5c139e2d8a260544bc5e730de0440edbab4b0f03 (patch)
treeb477208925fe3b373d4833460b90d61a8051cf05 /src/zenhttp
parent5.7.7-pre3 (diff)
downloadzen-5c139e2d8a260544bc5e730de0440edbab4b0f03.tar.xz
zen-5c139e2d8a260544bc5e730de0440edbab4b0f03.zip
add support for OTLP logging/tracing (#599)
- adds `zentelemetry` project which houses new functionality for serializing logs and traces in OpenTelemetry Protocol format (OTLP) - moved existing stats functionality from `zencore` to `zentelemetry` - adds `TRefCounted<T>` for vtable-less refcounting - adds `MemoryArena` class which allows for linear allocation of memory from chunks - adds `protozero` which is used to encode OTLP protobuf messages
Diffstat (limited to 'src/zenhttp')
-rw-r--r--src/zenhttp/httpserver.cpp5
-rw-r--r--src/zenhttp/include/zenhttp/httptest.h2
-rw-r--r--src/zenhttp/xmake.lua2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp
index 2c063d646..f48c22367 100644
--- a/src/zenhttp/httpserver.cpp
+++ b/src/zenhttp/httpserver.cpp
@@ -86,6 +86,9 @@ MapContentTypeToString(HttpContentType ContentType)
case HttpContentType::kXML:
return "application/xml"sv;
+
+ case HttpContentType::kProtobuf:
+ return "application/x-protobuf"sv;
}
}
@@ -119,6 +122,7 @@ static constinit uint32_t HashImagePng = HashStringDjb2("image/png"sv);
static constinit uint32_t HashIcon = HashStringDjb2("ico"sv);
static constinit uint32_t HashImageIcon = HashStringDjb2("image/x-icon"sv);
static constinit uint32_t HashXml = HashStringDjb2("application/xml"sv);
+static constinit uint32_t HashProtobuf = HashStringDjb2("application/x-protobuf"sv);
std::once_flag InitContentTypeLookup;
@@ -153,6 +157,7 @@ struct HashedTypeEntry
{HashIcon, HttpContentType::kIcon},
{HashImageIcon, HttpContentType::kIcon},
{HashXml, HttpContentType::kXML},
+ {HashProtobuf, HttpContentType::kProtobuf},
// clang-format on
};
diff --git a/src/zenhttp/include/zenhttp/httptest.h b/src/zenhttp/include/zenhttp/httptest.h
index afe71fbce..608462809 100644
--- a/src/zenhttp/include/zenhttp/httptest.h
+++ b/src/zenhttp/include/zenhttp/httptest.h
@@ -3,8 +3,8 @@
#pragma once
#include <zencore/logging.h>
-#include <zencore/stats.h>
#include <zenhttp/httpserver.h>
+#include <zentelemetry/stats.h>
#include <atomic>
#include <unordered_map>
diff --git a/src/zenhttp/xmake.lua b/src/zenhttp/xmake.lua
index b6ffbe467..af4064012 100644
--- a/src/zenhttp/xmake.lua
+++ b/src/zenhttp/xmake.lua
@@ -7,7 +7,7 @@ target('zenhttp')
add_files("**.cpp")
add_files("servers/httpsys.cpp", {unity_ignored=true})
add_includedirs("include", {public=true})
- add_deps("zencore", "transport-sdk")
+ add_deps("zencore", "zentelemetry", "transport-sdk")
add_packages(
"vcpkg::asio",
"vcpkg::cpr",