mirror of
https://github.com/coturn/coturn.git
synced 2025-10-28 13:31:16 +01:00
Reduce ifdefs in code: TURN_NO_PROMETHEUS (#1116)
TURN_NO_PROMETHEUS define is used in minimal amount of places now
This commit is contained in:
parent
4bc872b663
commit
99cc8aaa65
@ -3572,12 +3572,10 @@ void turn_report_allocation_set(void *a, turn_time_t lifetime, int refresh) {
|
|||||||
(unsigned long)lifetime, type, saddr, rsaddr, ssl, cipher);
|
(unsigned long)lifetime, type, saddr, rsaddr, ssl, cipher);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TURN_NO_PROMETHEUS)
|
|
||||||
{
|
{
|
||||||
if (!refresh)
|
if (!refresh)
|
||||||
prom_inc_allocation(get_ioa_socket_type(ss->client_socket));
|
prom_inc_allocation(get_ioa_socket_type(ss->client_socket));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3631,7 +3629,6 @@ void turn_report_allocation_delete(void *a, SOCKET_TYPE socket_type) {
|
|||||||
(unsigned long)(ss->t_peer_sent_bytes));
|
(unsigned long)(ss->t_peer_sent_bytes));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(TURN_NO_PROMETHEUS)
|
|
||||||
{
|
{
|
||||||
if (ss->realm_options.name[0]) {
|
if (ss->realm_options.name[0]) {
|
||||||
|
|
||||||
@ -3655,7 +3652,6 @@ void turn_report_allocation_delete(void *a, SOCKET_TYPE socket_type) {
|
|||||||
}
|
}
|
||||||
prom_dec_allocation(socket_type);
|
prom_dec_allocation(socket_type);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,4 +203,19 @@ void start_prometheus_server(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void prom_set_finished_traffic(const char *realm, const char *user, unsigned long rsvp, unsigned long rsvb,
|
||||||
|
unsigned long sentp, unsigned long sentb, bool peer) {
|
||||||
|
UNUSED_ARG(realm);
|
||||||
|
UNUSED_ARG(user);
|
||||||
|
UNUSED_ARG(rsvp);
|
||||||
|
UNUSED_ARG(rsvb);
|
||||||
|
UNUSED_ARG(sentp);
|
||||||
|
UNUSED_ARG(sentb);
|
||||||
|
UNUSED_ARG(peer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void prom_inc_allocation(SOCKET_TYPE type) { UNUSED_ARG(type); }
|
||||||
|
|
||||||
|
void prom_dec_allocation(SOCKET_TYPE type) { UNUSED_ARG(type); }
|
||||||
|
|
||||||
#endif /* TURN_NO_PROMETHEUS */
|
#endif /* TURN_NO_PROMETHEUS */
|
||||||
|
|||||||
@ -2,18 +2,17 @@
|
|||||||
#ifndef __PROM_SERVER_H__
|
#ifndef __PROM_SERVER_H__
|
||||||
#define __PROM_SERVER_H__
|
#define __PROM_SERVER_H__
|
||||||
|
|
||||||
|
#include "ns_turn_ioalib.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define DEFAULT_PROM_SERVER_PORT (9641)
|
#define DEFAULT_PROM_SERVER_PORT (9641)
|
||||||
|
#define TURN_ALLOC_STR_MAX_SIZE (20)
|
||||||
|
|
||||||
#if !defined(TURN_NO_PROMETHEUS)
|
#if !defined(TURN_NO_PROMETHEUS)
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "ns_turn_ioalib.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -54,8 +53,6 @@ extern prom_counter_t *turn_total_traffic_peer_sentb;
|
|||||||
|
|
||||||
extern prom_gauge_t *turn_total_allocations_number;
|
extern prom_gauge_t *turn_total_allocations_number;
|
||||||
|
|
||||||
#define TURN_ALLOC_STR_MAX_SIZE (20)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -76,6 +73,12 @@ void prom_inc_stun_binding_error(void);
|
|||||||
|
|
||||||
void start_prometheus_server(void);
|
void start_prometheus_server(void);
|
||||||
|
|
||||||
|
void prom_set_finished_traffic(const char *realm, const char *user, unsigned long rsvp, unsigned long rsvb,
|
||||||
|
unsigned long sentp, unsigned long sentb, bool peer);
|
||||||
|
|
||||||
|
void prom_inc_allocation(SOCKET_TYPE type);
|
||||||
|
void prom_dec_allocation(SOCKET_TYPE type);
|
||||||
|
|
||||||
#endif /* TURN_NO_PROMETHEUS */
|
#endif /* TURN_NO_PROMETHEUS */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user