Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::otel_resource Struct Reference

OpenTelemetry resource representation. More...

#include <opentelemetry_adapter.h>

Collaboration diagram for kcenon::monitoring::otel_resource:
Collaboration graph

Public Member Functions

void add_attribute (const std::string &key, const std::string &value)
 
common::Result< std::string > get_attribute (const std::string &key) const
 

Public Attributes

otel_resource_type type {otel_resource_type::service}
 
std::vector< otel_attributeattributes
 

Detailed Description

OpenTelemetry resource representation.

Definition at line 90 of file opentelemetry_adapter.h.

Member Function Documentation

◆ add_attribute()

void kcenon::monitoring::otel_resource::add_attribute ( const std::string & key,
const std::string & value )
inline

Definition at line 94 of file opentelemetry_adapter.h.

94 {
95 attributes.emplace_back(key, value);
96 }
std::vector< otel_attribute > attributes

References attributes.

Referenced by kcenon::monitoring::create_service_resource().

Here is the caller graph for this function:

◆ get_attribute()

common::Result< std::string > kcenon::monitoring::otel_resource::get_attribute ( const std::string & key) const
inline

Definition at line 98 of file opentelemetry_adapter.h.

98 {
99 for (const auto& attr : attributes) {
100 if (attr.key == key) {
101 return common::Result<std::string>::ok(attr.value);
102 }
103 }
104 return common::Result<std::string>::err(error_info(monitoring_error_code::not_found,
105 "Attribute not found: " + key, "monitoring_system").to_common_error());
106 }

References attributes, and kcenon::monitoring::not_found.

Referenced by kcenon::monitoring::opentelemetry_metrics_adapter::convert_metrics().

Here is the caller graph for this function:

Member Data Documentation

◆ attributes

std::vector<otel_attribute> kcenon::monitoring::otel_resource::attributes

Definition at line 92 of file opentelemetry_adapter.h.

Referenced by add_attribute(), and get_attribute().

◆ type


The documentation for this struct was generated from the following file: