Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
begin adding some metrics to tcp-proxy
- Loading branch information
Showing
4 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1) | ||
|
||
INCLUDES?=-I../ext/prometheus-cpp-lite-1.0/core/include -I../ext/prometheus-cpp-lite-1.0/simpleapi/include | ||
INCLUDES?=-isystem ../ext/prometheus-cpp-lite-1.0/core/include -isystem ../ext/prometheus-cpp-lite-1.0/simpleapi/include | ||
|
||
all: | ||
$(CXX) -O3 -fno-rtti $(INCLUDES) -std=c++11 -pthread -frtti -o tcp-proxy tcp-proxy.cpp ../node/Metrics.cpp | ||
OBJS=Metrics.o \ | ||
../node/Metrics.o | ||
|
||
CXXFLAGS=-O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti | ||
|
||
all: $(OBJS) tcp-proxy.o | ||
$(CXX) -O3 -fno-rtti $(INCLUDES) -std=c++17 -pthread -frtti -o tcp-proxy tcp-proxy.o $(OBJS) | ||
|
||
clean: | ||
rm -f *.o tcp-proxy *.dSYM | ||
rm -f $(OBJS) tcp-proxy.o tcp-proxy *.dSYM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <prometheus/simpleapi.h> | ||
|
||
|
||
namespace ZeroTier { | ||
namespace Metrics { | ||
prometheus::simpleapi::counter_metric_t udp_open_failed | ||
{"udp_open_failed", "UDP open failed"}; | ||
|
||
prometheus::simpleapi::counter_metric_t tcp_opened | ||
{"tcp_opened", "TCP opened"}; | ||
prometheus::simpleapi::counter_metric_t tcp_closed | ||
{"tcp_closed", "TCP closed"}; | ||
|
||
prometheus::simpleapi::counter_metric_t tcp_bytes_in | ||
{"tcp_byes_in", "TCP bytes in"}; | ||
prometheus::simpleapi::counter_metric_t tcp_bytes_out | ||
{"tcp_byes_out", "TCP bytes out"}; | ||
|
||
prometheus::simpleapi::counter_metric_t udp_bytes_in | ||
{"udp_bytes_in", "UDP bytes in"}; | ||
prometheus::simpleapi::counter_metric_t udp_bytes_out | ||
{"udp_bytes_out", "UDP bytes out"}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef _TCP_PROXY_METRICS_H_ | ||
#define _TCP_PROXY_METRICS_H_ | ||
|
||
#include "../node/Metrics.hpp" | ||
|
||
namespace ZeroTier { | ||
namespace Metrics { | ||
extern prometheus::simpleapi::counter_metric_t udp_open_failed; | ||
|
||
extern prometheus::simpleapi::counter_metric_t tcp_opened; | ||
extern prometheus::simpleapi::counter_metric_t tcp_closed; | ||
|
||
extern prometheus::simpleapi::counter_metric_t tcp_bytes_in; | ||
extern prometheus::simpleapi::counter_metric_t tcp_bytes_out; | ||
|
||
extern prometheus::simpleapi::counter_metric_t udp_bytes_in; | ||
extern prometheus::simpleapi::counter_metric_t udp_bytes_out; | ||
} | ||
} | ||
|
||
#endif // _TCP_PROXY_METRICS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters