diff options
| author | Dan Engelbrecht <[email protected]> | 2025-08-22 18:16:09 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-08-22 18:16:09 +0200 |
| commit | fb6426127354415505dbedacd63b3a16116dac2f (patch) | |
| tree | bbc39a085433b1e837fb07ea4e4399ba932dbdca /src/zenserver/admin/admin.cpp | |
| parent | avoid new in static IoBuffer (#472) (diff) | |
| download | zen-fb6426127354415505dbedacd63b3a16116dac2f.tar.xz zen-fb6426127354415505dbedacd63b3a16116dac2f.zip | |
clean up trace options parsing (#473)
* clean up trace command line options
explicitly shut down worker pools
* some additional startup trace scopes
Diffstat (limited to 'src/zenserver/admin/admin.cpp')
| -rw-r--r-- | src/zenserver/admin/admin.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/zenserver/admin/admin.cpp b/src/zenserver/admin/admin.cpp index 8c2e6d771..f6ad14422 100644 --- a/src/zenserver/admin/admin.cpp +++ b/src/zenserver/admin/admin.cpp @@ -594,31 +594,35 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler, [this](HttpRouterRequest& Req) { HttpServerRequest& HttpReq = Req.ServerRequest(); const HttpServerRequest::QueryParams Params = HttpReq.GetQueryParams(); - TraceType Type = TraceType::None; - std::string HostOrPath; - if (auto Param = Params.GetValue("file"); Param.empty() == false) + TraceOptions TraceOptions; + + if (!IsTracing()) { - Type = TraceType::File; - HostOrPath = Param; + TraceInit("zenserver"); } - if (auto Param = Params.GetValue("host"); Param.empty() == false) + + if (auto Channels = Params.GetValue("channels"); Channels.empty() == false) { - Type = TraceType::Network; - HostOrPath = Param; + TraceOptions.Channels = Channels; } - if (Type == TraceType::None) + + if (auto File = Params.GetValue("file"); File.empty() == false) { - return Req.ServerRequest().WriteResponse(HttpResponseCode::BadRequest, - HttpContentType::kText, - "Invalid trace type, use `file` or `host`"sv); + TraceOptions.File = File; } - if (IsTracing()) + else if (auto Host = Params.GetValue("host"); Host.empty() == false) + { + TraceOptions.Host = Host; + } + else { return Req.ServerRequest().WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, - "Tracing is already enabled"sv); + "Invalid trace type, use `file` or `host`"sv); } - TraceStart("zenserver", HostOrPath.c_str(), Type); + + TraceConfigure(TraceOptions); + return Req.ServerRequest().WriteResponse(HttpResponseCode::OK, HttpContentType::kText, "Tracing started"); }, HttpVerb::kPost); |