|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
OpenTelemetry Protocol (OTLP) metrics exporter implementation. More...
#include <metric_exporters.h>


Public Member Functions | |
| otlp_metrics_exporter (const metric_export_config &config, const otel_resource &resource) | |
| Construct OTLP exporter with default transports. | |
| otlp_metrics_exporter (const metric_export_config &config, const otel_resource &resource, std::unique_ptr< http_transport > http_transport, std::unique_ptr< grpc_transport > grpc_transport) | |
| Construct OTLP exporter with custom transports. | |
| common::VoidResult | export_metrics (const std::vector< monitoring_data > &metrics) override |
| Export a batch of metrics. | |
| common::VoidResult | export_snapshot (const metrics_snapshot &snapshot) override |
| Export a single metrics snapshot. | |
| common::VoidResult | start () override |
| Start the exporter (for pull-based systems) | |
| common::VoidResult | stop () override |
| Stop the exporter. | |
| common::VoidResult | flush () override |
| Flush any pending metrics. | |
| common::VoidResult | shutdown () override |
| Shutdown the exporter. | |
| std::unordered_map< std::string, std::size_t > | get_stats () const override |
| Get exporter statistics. | |
Public Member Functions inherited from kcenon::monitoring::metric_exporter_interface | |
| virtual | ~metric_exporter_interface ()=default |
Private Member Functions | |
| bool | is_grpc_protocol () const |
| bool | is_http_protocol () const |
| std::string | get_content_type () const |
| common::VoidResult | send_otlp_batch (const std::vector< otel_metric_data > &metrics) |
| common::VoidResult | send_via_http (const std::vector< otel_metric_data > &metrics) |
| common::VoidResult | send_via_grpc (const std::vector< otel_metric_data > &metrics) |
| std::vector< uint8_t > | serialize_metrics (const std::vector< otel_metric_data > &metrics) const |
Private Attributes | |
| metric_export_config | config_ |
| std::unique_ptr< opentelemetry_metrics_adapter > | otel_adapter_ |
| std::unique_ptr< http_transport > | http_transport_ |
| std::unique_ptr< grpc_transport > | grpc_transport_ |
| std::atomic< std::size_t > | exported_metrics_ {0} |
| std::atomic< std::size_t > | failed_exports_ {0} |
| bool | started_ {false} |
OpenTelemetry Protocol (OTLP) metrics exporter implementation.
Exports metrics to OTLP-compatible backends via gRPC or HTTP. Supports OTLP/gRPC, OTLP/HTTP JSON, and OTLP/HTTP Protobuf formats.
Definition at line 795 of file metric_exporters.h.
|
inlineexplicit |
Construct OTLP exporter with default transports.
| config | Export configuration with endpoint and protocol |
| resource | OpenTelemetry resource attributes |
Definition at line 811 of file metric_exporters.h.
|
inline |
Construct OTLP exporter with custom transports.
| config | Export configuration |
| resource | OpenTelemetry resource attributes |
| http_transport | Custom HTTP transport (for OTLP/HTTP) |
| grpc_transport | Custom gRPC transport (for OTLP/gRPC) |
Definition at line 824 of file metric_exporters.h.
|
inlineoverridevirtual |
Export a batch of metrics.
Implements kcenon::monitoring::metric_exporter_interface.
Definition at line 833 of file metric_exporters.h.
References exported_metrics_, failed_exports_, kcenon::monitoring::operation_failed, otel_adapter_, kcenon::monitoring::processing_failed, send_otlp_batch(), and kcenon::monitoring::error_info::to_common_error().
Referenced by TEST_F(), TEST_F(), and TEST_F().


|
inlineoverridevirtual |
Export a single metrics snapshot.
Implements kcenon::monitoring::metric_exporter_interface.
Definition at line 864 of file metric_exporters.h.
References exported_metrics_, failed_exports_, kcenon::monitoring::operation_failed, otel_adapter_, kcenon::monitoring::processing_failed, send_otlp_batch(), and kcenon::monitoring::error_info::to_common_error().
Referenced by TEST_F().


|
inlineoverridevirtual |
Flush any pending metrics.
Implements kcenon::monitoring::metric_exporter_interface.
Definition at line 917 of file metric_exporters.h.
Referenced by TEST_F().

|
inlineprivate |
Definition at line 953 of file metric_exporters.h.
References config_, kcenon::monitoring::metric_export_config::format, kcenon::monitoring::otlp_http_json, and kcenon::monitoring::otlp_http_protobuf.
Referenced by send_via_http().

|
inlineoverridevirtual |
Get exporter statistics.
Implements kcenon::monitoring::metric_exporter_interface.
Definition at line 926 of file metric_exporters.h.
References exported_metrics_, failed_exports_, grpc_transport_, and is_grpc_protocol().
Referenced by TEST_F(), TEST_F(), and TEST_F().


|
inlineprivate |
Definition at line 944 of file metric_exporters.h.
References config_, kcenon::monitoring::metric_export_config::format, and kcenon::monitoring::otlp_grpc.
Referenced by get_stats(), and send_otlp_batch().

|
inlineprivate |
Definition at line 948 of file metric_exporters.h.
References config_, kcenon::monitoring::metric_export_config::format, kcenon::monitoring::otlp_http_json, and kcenon::monitoring::otlp_http_protobuf.
|
inlineprivate |
Definition at line 964 of file metric_exporters.h.
References is_grpc_protocol(), send_via_grpc(), and send_via_http().
Referenced by export_metrics(), and export_snapshot().


|
inlineprivate |
Definition at line 1024 of file metric_exporters.h.
References kcenon::monitoring::grpc_request::body, config_, kcenon::monitoring::dependency_missing, kcenon::monitoring::metric_export_config::endpoint, grpc_transport_, kcenon::monitoring::grpc_request::method, kcenon::monitoring::network_error, kcenon::monitoring::operation_failed, kcenon::monitoring::metric_export_config::port, serialize_metrics(), kcenon::monitoring::grpc_request::service, kcenon::monitoring::grpc_request::timeout, kcenon::monitoring::metric_export_config::timeout, and kcenon::monitoring::error_info::to_common_error().
Referenced by send_otlp_batch().


|
inlineprivate |
Definition at line 972 of file metric_exporters.h.
References kcenon::monitoring::http_request::body, config_, kcenon::monitoring::dependency_missing, kcenon::monitoring::metric_export_config::endpoint, get_content_type(), kcenon::monitoring::http_request::headers, kcenon::monitoring::metric_export_config::headers, http_transport_, kcenon::monitoring::http_request::method, kcenon::monitoring::network_error, kcenon::monitoring::operation_failed, kcenon::monitoring::metric_export_config::port, serialize_metrics(), kcenon::monitoring::http_request::timeout, kcenon::monitoring::metric_export_config::timeout, kcenon::monitoring::error_info::to_common_error(), and kcenon::monitoring::http_request::url.
Referenced by send_otlp_batch().


|
inlineprivate |
Definition at line 1071 of file metric_exporters.h.
References kcenon::monitoring::metric::name, and kcenon::monitoring::metric::value.
Referenced by send_via_grpc(), and send_via_http().

|
inlineoverridevirtual |
Shutdown the exporter.
Implements kcenon::monitoring::metric_exporter_interface.
Definition at line 922 of file metric_exporters.h.
References stop().
Referenced by TEST_F().


|
inlineoverridevirtual |
Start the exporter (for pull-based systems)
Reimplemented from kcenon::monitoring::metric_exporter_interface.
Definition at line 893 of file metric_exporters.h.
References started_.
Referenced by TEST_F().

|
inlineoverridevirtual |
Stop the exporter.
Reimplemented from kcenon::monitoring::metric_exporter_interface.
Definition at line 904 of file metric_exporters.h.
References grpc_transport_, and started_.
Referenced by shutdown(), and TEST_F().

|
private |
Definition at line 797 of file metric_exporters.h.
Referenced by get_content_type(), is_grpc_protocol(), is_http_protocol(), send_via_grpc(), and send_via_http().
|
private |
Definition at line 801 of file metric_exporters.h.
Referenced by export_metrics(), export_snapshot(), and get_stats().
|
private |
Definition at line 802 of file metric_exporters.h.
Referenced by export_metrics(), export_snapshot(), and get_stats().
|
private |
Definition at line 800 of file metric_exporters.h.
Referenced by get_stats(), send_via_grpc(), and stop().
|
private |
Definition at line 799 of file metric_exporters.h.
Referenced by send_via_http().
|
private |
Definition at line 798 of file metric_exporters.h.
Referenced by export_metrics(), and export_snapshot().
|
private |