Skip to content

Commit

Permalink
metrics: add metrics.{c,h} for global functions
Browse files Browse the repository at this point in the history
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
  • Loading branch information
alltilla committed Jun 24, 2024
1 parent 7b18012 commit f890a2f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/apphook.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "dnscache.h"
#include "alarms.h"
#include "stats/stats-registry.h"
#include "metrics/metrics-tls-cache.h"
#include "metrics/metrics.h"
#include "healthcheck/healthcheck-stats.h"
#include "logmsg/logmsg.h"
#include "logsource.h"
Expand Down Expand Up @@ -228,7 +228,7 @@ app_startup(void)
alarm_init();
main_loop_thread_resource_init();
stats_init();
metrics_tls_cache_global_init();
metrics_global_init();
healthcheck_stats_global_init();
tzset();
log_msg_global_init();
Expand Down Expand Up @@ -283,7 +283,7 @@ app_shutdown(void)
log_msg_global_deinit();

afinter_global_deinit();
metrics_tls_cache_global_deinit();
metrics_global_deinit();
stats_destroy();
child_manager_deinit();
g_list_foreach(application_hooks, (GFunc) g_free, NULL);
Expand Down
2 changes: 2 additions & 0 deletions lib/metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set(METRICS_HEADERS
metrics/metrics.h
metrics/metrics-tls-cache.h
metrics/metrics-template.h
metrics/label-template.h
PARENT_SCOPE)

set(METRICS_SOURCES
metrics/metrics.c
metrics/metrics-tls-cache.c
metrics/metrics-template.c
metrics/label-template.c
Expand Down
2 changes: 2 additions & 0 deletions lib/metrics/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ metricsincludedir = ${pkgincludedir}/metrics
EXTRA_DIST += lib/metrics/CMakeLists.txt

metricsinclude_HEADERS = \
lib/metrics/metrics.h \
lib/metrics/metrics-tls-cache.h \
lib/metrics/metrics-template.h \
lib/metrics/label-template.h

metrics_sources = \
lib/metrics/metrics.c \
lib/metrics/metrics-tls-cache.c \
lib/metrics/metrics-template.c \
lib/metrics/label-template.c
Expand Down
38 changes: 38 additions & 0 deletions lib/metrics/metrics.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 Axoflow
* Copyright (c) 2024 Attila Szakacs <attila.szakacs@axoflow.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/

#include "metrics.h"
#include "metrics-tls-cache.h"

void
metrics_global_init(void)
{
metrics_tls_cache_global_init();
}

void
metrics_global_deinit(void)
{
metrics_tls_cache_global_deinit();
}
31 changes: 31 additions & 0 deletions lib/metrics/metrics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 Axoflow
* Copyright (c) 2024 Attila Szakacs <attila.szakacs@axoflow.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/

#ifndef METRICS_H_INCLUDED
#define METRICS_H_INCLUDED

void metrics_global_init(void);
void metrics_global_deinit(void);

#endif
1 change: 1 addition & 0 deletions tests/copyright/policy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ lib/metrics-pipe\.[ch]
lib/metrics/label-template\.(c|h)$
lib/metrics/metrics-template\.(c|h)$
lib/metrics/metrics-tls-cache\.(c|h)$
lib/metrics/metrics\.(c|h)$
lib/rewrite/rewrite-set-facility\.h
lib/rewrite/rewrite-set-matches\.[ch]
lib/rewrite/rewrite-unset-matches\.[ch]
Expand Down

0 comments on commit f890a2f

Please sign in to comment.