instrument_resource (instrument v1.0.0)
View SourceOpenTelemetry Resource representation.
A Resource describes the entity producing telemetry. It contains attributes that identify the service, host, process, etc.
Example Usage
%% Create a resource
Resource = instrument_resource:create(#{
<<"service.name">> => <<"my-service">>,
<<"service.version">> => <<"1.0.0">>
}).
%% Merge resources (later values override)
Merged = instrument_resource:merge(Resource1, Resource2).
%% Get the default resource (with detectors)
Default = instrument_resource:default().
Summary
Functions
Creates a resource with the given attributes.
Creates a resource with attributes and schema URL.
Creates a default resource with SDK and detected attributes.
Creates an empty resource.
Gets the attributes from a resource.
Gets the global default resource.
Gets the schema URL from a resource.
Merges two resources. Later resource attributes override earlier ones.
Sets the global default resource.
Functions
Creates a resource with the given attributes.
-spec create(map(), binary() | undefined) -> #resource{attributes :: map(), schema_url :: binary() | undefined}.
Creates a resource with attributes and schema URL.
Creates a default resource with SDK and detected attributes.
Creates an empty resource.
Gets the attributes from a resource.
Gets the global default resource.
-spec get_schema_url(#resource{attributes :: map(), schema_url :: binary() | undefined}) -> binary() | undefined.
Gets the schema URL from a resource.
-spec merge(#resource{attributes :: map(), schema_url :: binary() | undefined}, #resource{attributes :: map(), schema_url :: binary() | undefined}) -> #resource{attributes :: map(), schema_url :: binary() | undefined}.
Merges two resources. Later resource attributes override earlier ones.
Sets the global default resource.