Remove cmake from the build process

While I'm here change the name of the module to ngx_otel_module.
This commit is contained in:
Sergey A. Osokin 2024-12-02 16:24:01 -05:00
parent 1d25954274
commit 3a655dfa8a
6 changed files with 323 additions and 211 deletions

View file

@ -1,14 +0,0 @@
#include <ngx_config.h>
#include <ngx_core.h>
extern ngx_module_t gHttpModule;
ngx_module_t* ngx_modules[] = {
&gHttpModule,
NULL
};
char* ngx_module_names[] = {
"ngx_http_otel_module",
NULL
};

View file

@ -8,7 +8,7 @@
#include <fstream>
extern ngx_module_t gHttpModule;
extern ngx_module_t ngx_otel_module;
namespace {
@ -168,18 +168,18 @@ bool iremovePrefix(ngx_str_t* str, StrView p)
MainConf* getMainConf(ngx_conf_t* cf)
{
return static_cast<MainConf*>(
(MainConfBase*)ngx_http_conf_get_module_main_conf(cf, gHttpModule));
(MainConfBase*)ngx_http_conf_get_module_main_conf(cf, ngx_otel_module));
}
MainConf* getMainConf(ngx_cycle_t* cycle)
{
return static_cast<MainConf*>(
(MainConfBase*)ngx_http_cycle_get_module_main_conf(cycle, gHttpModule));
(MainConfBase*)ngx_http_cycle_get_module_main_conf(cycle, ngx_otel_module));
}
LocationConf* getLocationConf(ngx_http_request_t* r)
{
return (LocationConf*)ngx_http_get_module_loc_conf(r, gHttpModule);
return (LocationConf*)ngx_http_get_module_loc_conf(r, ngx_otel_module);
}
void cleanupOtelCtx(void* data)
@ -188,7 +188,7 @@ void cleanupOtelCtx(void* data)
OtelCtx* getOtelCtx(ngx_http_request_t* r)
{
auto ctx = (OtelCtx*)ngx_http_get_module_ctx(r, gHttpModule);
auto ctx = (OtelCtx*)ngx_http_get_module_ctx(r, ngx_otel_module);
// restore module context if it was reset by e.g. internal redirect
if (ctx == NULL && (r->internal || r->filter_finalize)) {
@ -196,7 +196,7 @@ OtelCtx* getOtelCtx(ngx_http_request_t* r)
for (auto cln = r->pool->cleanup; cln; cln = cln->next) {
if (cln->handler == cleanupOtelCtx) {
ctx = (OtelCtx*)cln->data;
ngx_http_set_ctx(r, ctx, gHttpModule);
ngx_http_set_ctx(r, ctx, ngx_otel_module);
break;
}
}
@ -217,7 +217,7 @@ OtelCtx* createOtelCtx(ngx_http_request_t* r)
storage->handler = cleanupOtelCtx;
auto ctx = new (storage->data) OtelCtx{};
ngx_http_set_ctx(r, ctx, gHttpModule);
ngx_http_set_ctx(r, ctx, ngx_otel_module);
return ctx;
}
@ -932,7 +932,7 @@ char* mergeLocationConf(ngx_conf_t* cf, void* parent, void* child)
return NGX_CONF_OK;
}
ngx_http_module_t gHttpModuleCtx = {
ngx_http_module_t ngx_otel_moduleCtx = {
addVariables, /* preconfiguration */
initModule, /* postconfiguration */
@ -948,9 +948,9 @@ ngx_http_module_t gHttpModuleCtx = {
}
ngx_module_t gHttpModule = {
ngx_module_t ngx_otel_module = {
NGX_MODULE_V1,
&gHttpModuleCtx, /* module context */
&ngx_otel_moduleCtx, /* module context */
gCommands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */