Giter VIP home page Giter VIP logo

otel-schema-utils's Introduction

OpenTelemetry Schema Utilities

Go Reference CI

This repository provides conversion utilities for OpenTelemetry Go types using OpenTelemetry schemas.

๐Ÿšง This repository is a work in progress and not production ready.

Getting Started

Start by importing the project.

import "github.com/MrAlias/otel-schema-utils/schema"

From there, construct a new Converter using the default client.

// Passing nil here means the Converter will use schema.DefaultClient.
conv := schema.NewConverter(nil)

Use the Converter to convert OpenTelemetry Go types. For example a *resource.Resource.

targetURL := "https://opentelemetry.io/schemas/1.20.0"
r, err := conv.Resource(ctx, targetURL, myResource)
// Handle err and use the v1.20.0 Resource r ...

Clients

Clients is used to fetch, cache, and parse OpenTelemetry schemas. These schema can be located locally or on remote hosts. Multiple constructors are provided to accommodate this variety in schema sources.

All clients will cache schemas. Meaning any schema they return will only be fetched once from its source. All subsequent requests for that schema will returned the same value.

Static client

A static client fetches a static set of schemas passed to the client when it is constructed. These clients are created using the NewStaticClient function.

Local client

A local client is a static client seeded with all OpenTelemetry schemas.

These clients are useful if you want to ensure the client does not fetch any remote schemas, but still want to support OpenTelemetry published schemas. They are created using the NewLocalClient function.

HTTP client

An HTTP client fetches schemas with an HTTP request.

These clients are useful if you publish your own schemas or want to use 3rd-party schemas other than OpenTelemetry ones. They are created using the NewHTTPClient function.

Default client

A default client is provided as the DefaultClient variable. This client will use a local client for all OpenTelemetry published schema, but also use an HTTP client for all uncached schemas.

License

This Go module is distributed under the Apache-2.0 license found in the LICENSE file.

otel-schema-utils's People

Contributors

dependabot[bot] avatar mralias avatar

Watchers

 avatar  avatar

otel-schema-utils's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.