|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
#include <gtest/gtest.h>#include <kcenon/monitoring/exporters/metric_exporters.h>#include <kcenon/monitoring/exporters/udp_transport.h>#include <kcenon/monitoring/exporters/http_transport.h>#include <kcenon/monitoring/exporters/grpc_transport.h>#include <kcenon/monitoring/interfaces/monitorable_interface.h>#include <kcenon/monitoring/interfaces/monitoring_core.h>#include <kcenon/monitoring/exporters/opentelemetry_adapter.h>#include <thread>#include <chrono>
Go to the source code of this file.
Classes | |
| class | MetricExportersTest |
Functions | |
| TEST_F (MetricExportersTest, MetricExportConfigValidation) | |
| TEST_F (MetricExportersTest, PrometheusMetricConversion) | |
| TEST_F (MetricExportersTest, PrometheusTextFormat) | |
| TEST_F (MetricExportersTest, PrometheusExporterBasicFunctionality) | |
| TEST_F (MetricExportersTest, StatsDMetricConversion) | |
| TEST_F (MetricExportersTest, StatsDTextFormat) | |
| TEST_F (MetricExportersTest, StatsDExporterBasicFunctionality) | |
| TEST_F (MetricExportersTest, OtlpMetricsExporterBasicFunctionality) | |
| TEST_F (MetricExportersTest, MetricExporterFactory) | |
| TEST_F (MetricExportersTest, SupportedFormatsQuery) | |
| TEST_F (MetricExportersTest, HelperFunctions) | |
| TEST_F (MetricExportersTest, EmptyMetricsHandling) | |
| TEST_F (MetricExportersTest, LargeMetricBatch) | |
| TEST_F (MetricExportersTest, MetricNameSanitization) | |
| TEST_F (MetricExportersTest, MetricTypeInference) | |
| TEST (UdpTransportTest, StubTransportBasicFunctionality) | |
| TEST (UdpTransportTest, StubTransportSimulateFailure) | |
| TEST (UdpTransportTest, StubTransportStatisticsReset) | |
| TEST (UdpTransportTest, DefaultTransportCreation) | |
| TEST (GrpcTransportTest, StubTransportBasicFunctionality) | |
| TEST (GrpcTransportTest, StubTransportCustomResponseHandler) | |
| TEST (GrpcTransportTest, StubTransportSimulateFailure) | |
| TEST (GrpcTransportTest, DefaultTransportCreation) | |
| TEST_F (MetricExportersTest, StatsDExporterWithCustomTransport) | |
| TEST_F (MetricExportersTest, StatsDExporterTransportFailure) | |
| TEST_F (MetricExportersTest, OtlpExporterWithCustomHttpTransport) | |
| TEST (HttpTransportTest, SimpleHttpClientValidUrls) | |
| TEST (HttpTransportTest, SimpleHttpClientInvalidUrls) | |
| TEST (HttpTransportTest, SimpleHttpClientPortDefaults) | |
| TEST (HttpTransportTest, SimpleHttpClientNameAndAvailability) | |
| TEST (HttpTransportTest, StubHttpTransportIsAvailableAndName) | |
| TEST (GrpcTransportTest, StubTransportResetStatistics) | |
| TEST (GrpcTransportTest, StubTransportDisconnectedState) | |
| TEST (UdpTransportTest, StubTransportStringSendDelegation) | |
| TEST_F (MetricExportersTest, OtlpExporterWithCustomGrpcTransport) | |
| TEST | ( | GrpcTransportTest | , |
| DefaultTransportCreation | ) |
Definition at line 696 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_default_grpc_transport().

| TEST | ( | GrpcTransportTest | , |
| StubTransportBasicFunctionality | ) |
Definition at line 611 of file test_metric_exporters.cpp.
References kcenon::monitoring::grpc_request::body, kcenon::monitoring::create_stub_grpc_transport(), kcenon::monitoring::grpc_request::method, kcenon::monitoring::grpc_request::service, and kcenon::monitoring::grpc_request::timeout.

| TEST | ( | GrpcTransportTest | , |
| StubTransportCustomResponseHandler | ) |
Definition at line 650 of file test_metric_exporters.cpp.
References kcenon::monitoring::grpc_request::body, kcenon::monitoring::grpc_response::body, kcenon::monitoring::create_stub_grpc_transport(), kcenon::monitoring::grpc_request::method, kcenon::monitoring::grpc_response::status_code, and kcenon::monitoring::grpc_response::status_message.

| TEST | ( | GrpcTransportTest | , |
| StubTransportDisconnectedState | ) |
Definition at line 893 of file test_metric_exporters.cpp.
References kcenon::monitoring::grpc_request::body, and kcenon::monitoring::create_stub_grpc_transport().

| TEST | ( | GrpcTransportTest | , |
| StubTransportResetStatistics | ) |
Definition at line 873 of file test_metric_exporters.cpp.
References kcenon::monitoring::grpc_request::body, and kcenon::monitoring::create_stub_grpc_transport().

| TEST | ( | GrpcTransportTest | , |
| StubTransportSimulateFailure | ) |
Definition at line 673 of file test_metric_exporters.cpp.
References kcenon::monitoring::grpc_request::body, and kcenon::monitoring::create_stub_grpc_transport().

| TEST | ( | HttpTransportTest | , |
| SimpleHttpClientInvalidUrls | ) |
Definition at line 818 of file test_metric_exporters.cpp.
References kcenon::monitoring::client, and kcenon::monitoring::http_request::url.
| TEST | ( | HttpTransportTest | , |
| SimpleHttpClientNameAndAvailability | ) |
Definition at line 852 of file test_metric_exporters.cpp.
References kcenon::monitoring::client.
| TEST | ( | HttpTransportTest | , |
| SimpleHttpClientPortDefaults | ) |
Definition at line 838 of file test_metric_exporters.cpp.
References kcenon::monitoring::client, and kcenon::monitoring::http_request::url.
| TEST | ( | HttpTransportTest | , |
| SimpleHttpClientValidUrls | ) |
Definition at line 796 of file test_metric_exporters.cpp.
References kcenon::monitoring::client, and kcenon::monitoring::http_request::url.
| TEST | ( | HttpTransportTest | , |
| StubHttpTransportIsAvailableAndName | ) |
Definition at line 862 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_transport().

| TEST | ( | UdpTransportTest | , |
| DefaultTransportCreation | ) |
Definition at line 600 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_default_udp_transport().

| TEST | ( | UdpTransportTest | , |
| StubTransportBasicFunctionality | ) |
Definition at line 525 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport().

| TEST | ( | UdpTransportTest | , |
| StubTransportSimulateFailure | ) |
Definition at line 562 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport().

| TEST | ( | UdpTransportTest | , |
| StubTransportStatisticsReset | ) |
Definition at line 582 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport().

| TEST | ( | UdpTransportTest | , |
| StubTransportStringSendDelegation | ) |
Definition at line 915 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport().

| TEST_F | ( | MetricExportersTest | , |
| EmptyMetricsHandling | ) |
Definition at line 414 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::prometheus_exporter::export_metrics(), kcenon::monitoring::prometheus_exporter::export_snapshot(), kcenon::monitoring::metric_export_config::format, and kcenon::monitoring::prometheus_exporter::get_stats().

| TEST_F | ( | MetricExportersTest | , |
| HelperFunctions | ) |
Definition at line 399 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_otlp_metrics_exporter(), kcenon::monitoring::create_prometheus_exporter(), and kcenon::monitoring::create_statsd_exporter().

| TEST_F | ( | MetricExportersTest | , |
| LargeMetricBatch | ) |
Definition at line 435 of file test_metric_exporters.cpp.
References kcenon::monitoring::monitoring_data::add_metric(), kcenon::monitoring::monitoring_data::add_tag(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::statsd_exporter::export_metrics(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::statsd_exporter::get_stats(), and kcenon::monitoring::metric_export_config::max_batch_size.

| TEST_F | ( | MetricExportersTest | , |
| MetricExportConfigValidation | ) |
Definition at line 72 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, kcenon::monitoring::invalid_interval, kcenon::monitoring::metric_export_config::max_batch_size, kcenon::monitoring::metric_export_config::max_queue_size, kcenon::monitoring::metric_export_config::port, kcenon::monitoring::metric_export_config::push_interval, and kcenon::monitoring::metric_export_config::validate().

| TEST_F | ( | MetricExportersTest | , |
| MetricExporterFactory | ) |
Definition at line 340 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_exporter_factory::create_exporter(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, and kcenon::monitoring::metric_export_config::port.

| TEST_F | ( | MetricExportersTest | , |
| MetricNameSanitization | ) |
Definition at line 459 of file test_metric_exporters.cpp.
References kcenon::monitoring::monitoring_data::add_metric(), kcenon::monitoring::prometheus_exporter::convert_monitoring_data(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, and kcenon::monitoring::metric::name.

| TEST_F | ( | MetricExportersTest | , |
| MetricTypeInference | ) |
Definition at line 488 of file test_metric_exporters.cpp.
References kcenon::monitoring::monitoring_data::add_metric(), kcenon::monitoring::statsd_exporter::convert_monitoring_data(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, and kcenon::monitoring::metric_export_config::port.

| TEST_F | ( | MetricExportersTest | , |
| OtlpExporterWithCustomGrpcTransport | ) |
Definition at line 933 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_grpc_transport(), kcenon::monitoring::create_stub_transport(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::otlp_metrics_exporter::export_metrics(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::otlp_metrics_exporter::get_stats(), and kcenon::monitoring::metric_export_config::port.

| TEST_F | ( | MetricExportersTest | , |
| OtlpExporterWithCustomHttpTransport | ) |
Definition at line 765 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_grpc_transport(), kcenon::monitoring::create_stub_transport(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::otlp_metrics_exporter::export_metrics(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::otlp_metrics_exporter::get_stats(), kcenon::monitoring::metric_export_config::port, kcenon::monitoring::otlp_metrics_exporter::start(), and kcenon::monitoring::otlp_metrics_exporter::stop().

| TEST_F | ( | MetricExportersTest | , |
| OtlpMetricsExporterBasicFunctionality | ) |
Definition at line 311 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::otlp_metrics_exporter::export_metrics(), kcenon::monitoring::otlp_metrics_exporter::export_snapshot(), kcenon::monitoring::otlp_metrics_exporter::flush(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::otlp_metrics_exporter::get_stats(), and kcenon::monitoring::otlp_metrics_exporter::shutdown().

| TEST_F | ( | MetricExportersTest | , |
| PrometheusExporterBasicFunctionality | ) |
Definition at line 181 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::prometheus_exporter::export_metrics(), kcenon::monitoring::prometheus_exporter::export_snapshot(), kcenon::monitoring::prometheus_exporter::flush(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::prometheus_exporter::get_metrics_text(), kcenon::monitoring::prometheus_exporter::get_stats(), and kcenon::monitoring::prometheus_exporter::shutdown().

| TEST_F | ( | MetricExportersTest | , |
| PrometheusMetricConversion | ) |
Definition at line 120 of file test_metric_exporters.cpp.
References kcenon::monitoring::prometheus_exporter::convert_monitoring_data(), kcenon::monitoring::prometheus_exporter::convert_snapshot(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, kcenon::monitoring::metric_export_config::instance_id, and kcenon::monitoring::metric_export_config::labels.

| TEST_F | ( | MetricExportersTest | , |
| PrometheusTextFormat | ) |
Definition at line 160 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric::name, kcenon::monitoring::prometheus_text, kcenon::monitoring::metric::timestamp, kcenon::monitoring::metric::type, and kcenon::monitoring::metric::value.
| TEST_F | ( | MetricExportersTest | , |
| StatsDExporterBasicFunctionality | ) |
Definition at line 280 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::statsd_exporter::export_metrics(), kcenon::monitoring::statsd_exporter::export_snapshot(), kcenon::monitoring::statsd_exporter::flush(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::statsd_exporter::get_stats(), kcenon::monitoring::metric_export_config::port, and kcenon::monitoring::statsd_exporter::shutdown().

| TEST_F | ( | MetricExportersTest | , |
| StatsDExporterTransportFailure | ) |
Definition at line 741 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::statsd_exporter::export_metrics(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::statsd_exporter::get_stats(), and kcenon::monitoring::metric_export_config::port.

| TEST_F | ( | MetricExportersTest | , |
| StatsDExporterWithCustomTransport | ) |
Definition at line 706 of file test_metric_exporters.cpp.
References kcenon::monitoring::create_stub_udp_transport(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::statsd_exporter::export_metrics(), kcenon::monitoring::metric_export_config::format, kcenon::monitoring::statsd_exporter::get_stats(), kcenon::monitoring::metric_export_config::port, kcenon::monitoring::statsd_exporter::start(), and kcenon::monitoring::statsd_exporter::stop().

| TEST_F | ( | MetricExportersTest | , |
| StatsDMetricConversion | ) |
Definition at line 217 of file test_metric_exporters.cpp.
References kcenon::monitoring::statsd_exporter::convert_monitoring_data(), kcenon::monitoring::statsd_exporter::convert_snapshot(), kcenon::monitoring::metric_export_config::endpoint, kcenon::monitoring::metric_export_config::format, kcenon::monitoring::metric_export_config::instance_id, kcenon::monitoring::metric_export_config::labels, and kcenon::monitoring::metric_export_config::port.

| TEST_F | ( | MetricExportersTest | , |
| StatsDTextFormat | ) |
Definition at line 250 of file test_metric_exporters.cpp.
References kcenon::monitoring::statsd_metric_data::name, kcenon::monitoring::statsd_metric_data::sample_rate, kcenon::monitoring::statsd_metric_data::tags, kcenon::monitoring::statsd_metric_data::to_statsd_format(), kcenon::monitoring::statsd_metric_data::type, and kcenon::monitoring::statsd_metric_data::value.

| TEST_F | ( | MetricExportersTest | , |
| SupportedFormatsQuery | ) |
Definition at line 375 of file test_metric_exporters.cpp.
References kcenon::monitoring::metric_exporter_factory::get_supported_formats().
