forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable metrics at compile-time (opentibiabr#2509)
To install the libraries, need to run the following commands: For Windows systems (with static linking): • vcpkg install opentelemetry-cpp[default-features,otlp-http,prometheus] --triplet x64-windows-static For Windows systems (with dynamic linking): • vcpkg install opentelemetry-cpp[default-features,otlp-http,prometheus] --triplet x64-windows For Linux systems: • vcpkg install opentelemetry-cpp[default-features,otlp-http,prometheus] --triplet x64-linux
- Loading branch information
Showing
9 changed files
with
144 additions
and
60 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
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
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
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
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,6 +1,9 @@ | ||
target_sources(${PROJECT_NAME}_lib PRIVATE | ||
di/soft_singleton.cpp | ||
logging/log_with_spd_log.cpp | ||
metrics/metrics.cpp | ||
thread/thread_pool.cpp | ||
) | ||
|
||
if(FEATURE_METRICS) | ||
target_sources(${PROJECT_NAME}_lib PRIVATE metrics/metrics.cpp) | ||
endif() |
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,3 +1,4 @@ | ||
#ifdef FEATURE_METRICS | ||
/** | ||
* Canary - A free and open-source MMORPG server emulator | ||
* Copyright (©) 2019-2024 OpenTibiaBR <[email protected]> | ||
|
@@ -7,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; | ||
|
||
|
@@ -41,7 +42,7 @@ void Metrics::init(Options opts) { | |
initHistograms(); | ||
} | ||
|
||
void Metrics ::initHistograms() { | ||
void Metrics::initHistograms() { | ||
for (auto name : latencyNames) { | ||
auto instrumentSelector = metrics_sdk::InstrumentSelectorFactory::Create(metrics_sdk::InstrumentType::kHistogram, name, "us"); | ||
auto meterSelector = metrics_sdk::MeterSelectorFactory::Create("performance", otelVersion, otelSchema); | ||
|
@@ -108,3 +109,5 @@ void ScopedLatency::stop() { | |
auto attrskv = opentelemetry::common::KeyValueIterableView<decltype(attrs)> { attrs }; | ||
histogram->Record(elapsed, attrskv, context); | ||
} | ||
|
||
#endif // FEATURE_METRICS |
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
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
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