diff --git a/src/lib/metrics/metrics.cpp b/src/lib/metrics/metrics.cpp index 96ac557bbbd..cf11060125a 100644 --- a/src/lib/metrics/metrics.cpp +++ b/src/lib/metrics/metrics.cpp @@ -8,8 +8,8 @@ * Website: https://docs.opentibiabr.com/ */ -#include "metrics.hpp" -#include "lib/di/container.hpp" + #include "metrics.hpp" + #include "lib/di/container.hpp" using namespace metrics; diff --git a/src/lib/metrics/metrics.hpp b/src/lib/metrics/metrics.hpp index 55c5f82e9e0..92b23cd4577 100644 --- a/src/lib/metrics/metrics.hpp +++ b/src/lib/metrics/metrics.hpp @@ -8,24 +8,24 @@ * Website: https://docs.opentibiabr.com/ */ -#pragma once - -#include "game/scheduling/dispatcher.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #pragma once + + #include "game/scheduling/dispatcher.hpp" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace metrics_sdk = opentelemetry::sdk::metrics; namespace common = opentelemetry::common; @@ -39,13 +39,13 @@ constexpr std::string_view methodName(const char* s) { return prettyFunction.substr(space, bracket - space); } -#if defined(__GNUC__) || defined(__clang__) - #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__) -#elif defined(_MSC_VER) - #define __METHOD_NAME__ methodName(__FUNCSIG__) -#else - #error "Compiler not supported" -#endif + #if defined(__GNUC__) || defined(__clang__) + #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__) + #elif defined(_MSC_VER) + #define __METHOD_NAME__ methodName(__FUNCSIG__) + #else + #error "Compiler not supported" + #endif namespace metrics { using Meter = opentelemetry::nostd::shared_ptr; @@ -86,12 +86,12 @@ namespace metrics { bool stopped { false }; }; -#define DEFINE_LATENCY_CLASS(class_name, histogram_name, category) \ - class class_name##_latency final : public ScopedLatency { \ - public: \ - class_name##_latency(std::string_view name) : \ - ScopedLatency(name, histogram_name "_latency", category) { } \ - } + #define DEFINE_LATENCY_CLASS(class_name, histogram_name, category) \ + class class_name##_latency final : public ScopedLatency { \ + public: \ + class_name##_latency(std::string_view name) : \ + ScopedLatency(name, histogram_name "_latency", category) { } \ + } DEFINE_LATENCY_CLASS(method, "method", "method"); DEFINE_LATENCY_CLASS(lua, "lua", "scope"); diff --git a/src/pch.hpp b/src/pch.hpp index 1a47fc5404a..d1d6bc9f49e 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -176,37 +176,47 @@ struct fmt::formatter, char>> : formatter< #ifdef FEATURE_METRICS #define METRICS_METHOD_LATENCY_MEASURE() metrics::method_latency measure(__METHOD_NAME__) #else - #define METRICS_METHOD_LATENCY_MEASURE() do {} while (0) + #define METRICS_METHOD_LATENCY_MEASURE() \ + do { \ + } while (0) #endif #ifdef FEATURE_METRICS #define METRICS_LUA_LATENCY_MEASURE() metrics::lua_latency measure(getMetricsScope()) #else - #define METRICS_LUA_LATENCY_MEASURE() do {} while (0) + #define METRICS_LUA_LATENCY_MEASURE() \ + do { \ + } while (0) #endif #ifdef FEATURE_METRICS #define METRICS_TASK_LATENCY_MEASURE() metrics::task_latency measure(context) #else - #define METRICS_TASK_LATENCY_MEASURE() do {} while (0) + #define METRICS_TASK_LATENCY_MEASURE() \ + do { \ + } while (0) #endif #ifdef FEATURE_METRICS #define METRICS_LOCK_LATENCY_MEASURE(scope) metrics::lock_latency measureLock(scope) #else - #define METRICS_LOCK_LATENCY_MEASURE(scope) do {} while(0) + #define METRICS_LOCK_LATENCY_MEASURE(scope) \ + do { \ + } while (0) #endif #ifdef FEATURE_METRICS #define METRICS_STOP_LOCK_LATENCY() measureLock.stop() #else - #define METRICS_STOP_LOCK_LATENCY() do {} while(0) + #define METRICS_STOP_LOCK_LATENCY() \ + do { \ + } while (0) #endif #ifdef FEATURE_METRICS #define METRICS_QUERY_LATENCY_MEASURE(query) metrics::query_latency measure(query.substr(0, 50)) #else - #define METRICS_QUERY_LATENCY_MEASURE(query) do {} while(0) + #define METRICS_QUERY_LATENCY_MEASURE(query) \ + do { \ + } while (0) #endif - -