hs-opentelemetry-api-0.0.3.8: OpenTelemetry API for use by libraries for direct instrumentation or wrapper packages.
Copyright(c) Ian Duncan 2021
LicenseBSD-3
MaintainerIan Duncan
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

OpenTelemetry.Resource

Description

A Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the Resource.

Synopsis

Creating resources directly

mkResource :: [Maybe (Text, Attribute)] -> Resource r Source #

Utility function to create a resource from a list of fields and attributes. See the .= and .=? functions.

Since: 0.0.1.0

data Resource (schema :: Maybe Symbol) Source #

A set of attributes created from one or more resources.

A Resource is an immutable representation of the entity producing telemetry as Attributes. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name.

All three of these attributes can be included in the Resource.

Note that there are certain "standard attributes" that have prescribed meanings.

A number of these standard resources may be found in the OpenTelemetry.Resource.* modules.

The primary purpose of resources as a first-class concept in the SDK is decoupling of discovery of resource information from exporters. This allows for independent development and easy customization for users that need to integrate with closed source environments.

Instances

Instances details
Monoid (Resource s) Source # 
Instance details

Defined in OpenTelemetry.Resource

Methods

mempty :: Resource s #

mappend :: Resource s -> Resource s -> Resource s #

mconcat :: [Resource s] -> Resource s #

Semigroup (Resource s) Source # 
Instance details

Defined in OpenTelemetry.Resource

Methods

(<>) :: Resource s -> Resource s -> Resource s #

sconcat :: NonEmpty (Resource s) -> Resource s #

stimes :: Integral b => b -> Resource s -> Resource s #

(.=) :: ToAttribute a => Text -> a -> Maybe (Text, Attribute) Source #

Utility function to convert a required resource attribute into the format needed for mkResource.

(.=?) :: ToAttribute a => Text -> Maybe a -> Maybe (Text, Attribute) Source #

Utility function to convert an optional resource attribute into the format needed for mkResource.

type family ResourceMerge schemaLeft schemaRight :: Maybe Symbol where ... Source #

Static checks to prevent invalid resources from being merged.

Note: This is intended to be utilized for merging of resources whose attributes come from different sources, such as environment variables, or metadata extracted from the host or container.

The resulting resource will have all attributes that are on any of the two input resources. If a key exists on both the old and updating resource, the value of the updating resource will be picked (even if the updated value is "empty").

The resulting resource will have the Schema URL calculated as follows:

  • If the old resource's Schema URL is empty then the resulting resource's Schema URL will be set to the Schema URL of the updating resource,
  • Else if the updating resource's Schema URL is empty then the resulting resource's Schema URL will be set to the Schema URL of the old resource,
  • Else if the Schema URLs of the old and updating resources are the same then that will be the Schema URL of the resulting resource,
  • Else this is a merging error (this is the case when the Schema URL of the old and updating resources are not empty and are different). The resulting resource is therefore statically prohibited by this type-level function.

mergeResources Source #

Arguments

:: Resource old

the old resource

-> Resource new

the updating resource whose attributes take precedence

-> Resource (ResourceMerge old new) 

Combine two Resource values into a new Resource that contains the attributes of the two inputs.

See the ResourceMerge documentation about the additional semantics of merging two resources.

Since: 0.0.1.0

Creating resources from data structures

class ToResource a where Source #

A convenience class for converting arbitrary data into resources.

Associated Types

type ResourceSchema a :: Maybe Symbol Source #

Resource schema (if any) associated with the defined resource

Methods

toResource :: a -> Resource (ResourceSchema a) Source #

Convert the input value to a Resource

Instances

Instances details
ToResource Cloud Source # 
Instance details

Defined in OpenTelemetry.Resource.Cloud

Associated Types

type ResourceSchema Cloud :: Maybe Symbol Source #

ToResource Container Source # 
Instance details

Defined in OpenTelemetry.Resource.Container

Associated Types

type ResourceSchema Container :: Maybe Symbol Source #

ToResource DeploymentEnvironment Source # 
Instance details

Defined in OpenTelemetry.Resource.DeploymentEnvironment

ToResource FaaS Source # 
Instance details

Defined in OpenTelemetry.Resource.FaaS

Associated Types

type ResourceSchema FaaS :: Maybe Symbol Source #

ToResource Host Source # 
Instance details

Defined in OpenTelemetry.Resource.Host

Associated Types

type ResourceSchema Host :: Maybe Symbol Source #

ToResource Cluster Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Cluster :: Maybe Symbol Source #

ToResource Container Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Container :: Maybe Symbol Source #

ToResource CronJob Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema CronJob :: Maybe Symbol Source #

ToResource DaemonSet Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema DaemonSet :: Maybe Symbol Source #

ToResource Deployment Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Deployment :: Maybe Symbol Source #

ToResource Job Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Job :: Maybe Symbol Source #

ToResource Namespace Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Namespace :: Maybe Symbol Source #

ToResource Node Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Node :: Maybe Symbol Source #

ToResource Pod Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema Pod :: Maybe Symbol Source #

ToResource ReplicaSet Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema ReplicaSet :: Maybe Symbol Source #

ToResource StatefulSet Source # 
Instance details

Defined in OpenTelemetry.Resource.Kubernetes

Associated Types

type ResourceSchema StatefulSet :: Maybe Symbol Source #

ToResource OperatingSystem Source # 
Instance details

Defined in OpenTelemetry.Resource.OperatingSystem

ToResource Process Source # 
Instance details

Defined in OpenTelemetry.Resource.Process

Associated Types

type ResourceSchema Process :: Maybe Symbol Source #

ToResource ProcessRuntime Source # 
Instance details

Defined in OpenTelemetry.Resource.Process

ToResource Service Source # 
Instance details

Defined in OpenTelemetry.Resource.Service

Associated Types

type ResourceSchema Service :: Maybe Symbol Source #

ToResource Telemetry Source # 
Instance details

Defined in OpenTelemetry.Resource.Telemetry

Associated Types

type ResourceSchema Telemetry :: Maybe Symbol Source #

materializeResources :: MaterializeResource schema => Resource schema -> MaterializedResources Source #

Convert resource fields into a version that discharges the schema from the type level to the runtime level.

Using resources with a TracerProvider

data MaterializedResources Source #

A read-only resource attribute collection with an associated schema.

emptyMaterializedResources :: MaterializedResources Source #

A placeholder for MaterializedResources when no resource information is available, needed, or required.

Since: 0.0.1.0