Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = defaultClient(http.DefaultClient)
DefaultClient is the default Client used to fetch schemas. All OpenTelemetry published schema (i.e. ones with Schema Family identifiers https://opentelemetry.io/schemas/<version>) are fetched from a local pre-built cache. All other schema are fetched using the default HTTP client at the remote schema URL.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to fetch, cache, and parse schemas.
func NewHTTPClient ¶
NewHTTPClient returns a Client that fetches all requested schema via an HTTP request to the provided schema URL. All fetched schemas are cached.
func NewLocalClient ¶
func NewLocalClient() *Client
NewLocalClient is a static Client pre-loaded with all OpenTelemetry published schema (i.e. ones with Schema Family identifiers https://opentelemetry.io/schemas/<version>).
func NewStaticClient ¶
NewStaticClient returns a Client that will only return schemas contained in the passed data. The passed data is a map of schema URL to schema.
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter converts OpenTelemetry objects based on OpenTelemetry schema translations.
func NewConverter ¶
NewConverter returns a new Converter that uses the Client c to handle all schema fetching. If c is nil, the default client will be used.
func (Converter) MergeResources ¶
func (c Converter) MergeResources(ctx context.Context, schemaURL string, resources ...*resource.Resource) (*resource.Resource, error)
MergeResources creates a new resource by combining resources at the target schemaURL version.
If there are common keys between resources the latter resource will overwrite the former.
Any of the resources not already at schemaURL version will be appropriately upgraded or downgraded to match the version. An error is returned if this is not possible.
func (Converter) Resource ¶
func (c Converter) Resource(ctx context.Context, schemaURL string, orig *resource.Resource) (*resource.Resource, error)
Resource returns a copy of orig with the schema URL set to url and all attributes transformed based on the associated schema. If the schema transformation fails, or url is empty, an error is returned.