ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
resource Struct Referencefinal

Represents the entity producing telemetry data. More...

#include <resource.hpp>

Collaboration diagram for resource:
Collaboration graph

Public Member Functions

std::optional< std::string > service_name () const
 Gets the service name attribute if present.
 
std::optional< std::string > host_name () const
 Gets the host name attribute if present.
 
std::optional< std::string > host_id () const
 Gets the host ID (machine identifier) if present.
 

Static Public Member Functions

static resource from_environment (std::string_view service_name, std::string_view service_version)
 Creates a resource by detecting the local environment.
 

Public Attributes

attributes attrs
 Key-value pairs describing the resource.
 

Detailed Description

Represents the entity producing telemetry data.

A resource describes the source of telemetry data, typically representing a machine, service instance, or process. Resources are created once at startup and shared across all telemetry data produced by that entity.

This follows OpenTelemetry's resource semantic conventions.

Member Function Documentation

◆ from_environment()

resource from_environment ( std::string_view  service_name,
std::string_view  service_version 
)
static

Creates a resource by detecting the local environment.

This performs local derivation of the machine identity by hashing stable system properties (hostname, MAC addresses, etc.).

Parameters
service_nameThe logical name of the service.
service_versionThe version of the service.
Returns
A resource populated with detected attributes.
Here is the caller graph for this function:

Member Data Documentation

◆ attrs

attributes attrs

Key-value pairs describing the resource.

Standard OpenTelemetry resource attributes include:

  • service.name: Logical name of the service
  • service.version: Version of the service
  • service.instance.id: Unique instance identifier
  • host.name: Hostname of the machine
  • host.id: Unique host identifier (locally derived)
  • process.pid: Process ID