Git Product home page Git Product logo

opentelemetry-go-contrib's Introduction

OpenTelemetry-Go Contrib

build_and_test codecov.io Docs Go Report Card Slack

Collection of 3rd-party packages for OpenTelemetry-Go.

Contents

  • Instrumentation: Packages providing OpenTelemetry instrumentation for 3rd-party libraries.
  • Propagators: Packages providing OpenTelemetry context propagators for 3rd-party propagation formats.
  • Detectors: Packages providing OpenTelemetry resource detectors for 3rd-party cloud computing environments.
  • Exporters: Packages providing OpenTelemetry exporters for 3rd-party export formats.
  • Samplers: Packages providing additional implementations of OpenTelemetry samplers.
  • Bridges: Packages providing adapters for 3rd-party instrumentation frameworks.

Project Status

This project contains both stable and unstable modules. Refer to the module for its version or our versioning manifest.

Project versioning information and stability guarantees can be found in the versioning documentation.

Progress and status specific to this repository is tracked in our local project boards and milestones.

Compatibility

OpenTelemetry-Go Contrib ensures compatibility with the current supported versions of the Go language:

Each major Go release is supported until there are two newer major releases. For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release.

For versions of Go that are no longer supported upstream, opentelemetry-go-contrib will stop ensuring compatibility with these versions in the following manner:

  • A minor release of opentelemetry-go-contrib will be made to add support for the new supported release of Go.
  • The following minor release of opentelemetry-go-contrib will remove compatibility testing for the oldest (now archived upstream) version of Go. This, and future, releases of opentelemetry-go-contrib may include features only supported by the currently supported versions of Go.

This project is tested on the following systems.

OS Go Version Architecture
Ubuntu 1.22 amd64
Ubuntu 1.21 amd64
Ubuntu 1.22 386
Ubuntu 1.21 386
MacOS 1.22 amd64
MacOS 1.21 amd64
Windows 1.22 amd64
Windows 1.21 amd64
Windows 1.22 386
Windows 1.21 386

While this project should work for other systems, no compatibility guarantees are made for those systems currently.

Contributing

For information on how to contribute, consult the contributing guidelines

opentelemetry-go-contrib's People

Contributors

aneurysm9 avatar ash2k avatar bhautikpip avatar connorlindsey avatar dashpole avatar dependabot[bot] avatar dmathieu avatar erichsueh3 avatar evantorrie avatar fatsheep9146 avatar github-actions[bot] avatar jmacd avatar kkelvinlo avatar krnowak avatar lizthegrey avatar madvikinggod avatar matej-g avatar mikegoldsmith avatar mralias avatar opentelemetrybot avatar pdelewski avatar pellared avatar petrie avatar punya avatar reggiemcdonald avatar sergeykanzhelev avatar tonistiigi avatar xsam avatar ymotongpoo avatar yurishkuro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opentelemetry-go-contrib's Issues

Add more details on release process

Given that this contrib repo has a version dependency on the go.opentelemetry.io/otel repo as well as its own version (which may or may not be the same as the otel repo version), we likely need:

  • RELEASING.md
  • tag.sh
  • verify_examples.sh
    to ensure we release correctly tagged and verified releases.

Add Resource support in the Datadog exporter

Since release https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.4.3 the library has changed its exporter API to pass a *resource.Resource object through the pipeline. These are the static key:value labels that were configured with the SDK. They should be included as labels in any metric and span export.

There is an opportunity to compute a []string for these once and re-use it. The exporter should compute this caching on the first call to Export.

@marwan-at-work FYI

Upgrade to v0.7.0 of go.opentelemetry.io/otel

Related change log:

This release implements the v0.5.0 version of the OpenTelemetry specification.

Added

  • The othttp instrumentation now includes default metrics. (#861)
  • This CHANGELOG file to track all changes in the project going forward.
  • Support for array type attributes. (#798)
  • Apply transitive dependabot go.mod dependency updates as part of a new automatic Github workflow. (#844)
  • Timestamps are now passed to exporters for each export. (#835)
  • Add new Accumulation type to metric SDK to transport telemetry from Accumulators to Processors.
    This replaces the prior Record struct use for this purpose. (#835)
  • New dependabot integration to automate package upgrades. (#814)
  • Meter and Tracer implementations accept instrumentation version version as an optional argument.
    This instrumentation version is passed on to exporters. (#811) (#805) (#802)
  • The OTLP exporter includes the instrumentation version in telemetry it exports. (#811)
  • Environment variables for Jaeger exporter are supported. (#796)
  • New aggregation.Kind in the export metric API. (#808)
  • New example that uses OTLP and the collector. (#790)
  • Handle errors in the span SetName during span initialization. (#791)
  • Default service config to enable retries for retry-able failed requests in the OTLP exporter and an option to override this default. (#777)
  • New go.opentelemetry.io/otel/api/oterror package to uniformly support error handling and definitions for the project. (#778)
  • New global default implementation of the go.opentelemetry.io/otel/api/oterror.Handler interface to be used to handle errors prior to an user defined Handler.
    There is also functionality for the user to register their Handler as well as a convenience function Handle to handle an error with this global Handler(#778)
  • Options to specify propagators for httptrace and grpctrace instrumentation. (#784)
  • The required application/json header for the Zipkin exporter is included in all exports. (#774)
  • Integrate HTTP semantics helpers from the contrib repository into the api/standard package. #769

Changed

  • Rename Integrator to Processor in the metric SDK. (#863)
  • Rename AggregationSelector to AggregatorSelector. (#859)
  • Rename SynchronizedCopy to SynchronizedMove. (#858)
  • Rename simple integrator to basic integrator. (#857)
  • Merge otlp collector examples. (#841)
  • Change the metric SDK to support cumulative, delta, and pass-through exporters directly.
    With these changes, cumulative and delta specific exporters are able to request the correct kind of aggregation from the SDK. (#840)
  • The Aggregator.Checkpoint API is renamed to SynchronizedCopy and adds an argument, a different Aggregator into which the copy is stored. (#812)
  • The export.Aggregator contract is that Update() and SynchronizedCopy() are synchronized with each other.
    All the aggregation interfaces (Sum, LastValue, ...) are not meant to be synchronized, as the caller is expected to synchronize aggregators at a higher level after the Accumulator.
    Some of the Aggregators used unnecessary locking and that has been cleaned up. (#812)
  • Use of metric.Number was replaced by int64 now that we use sync.Mutex in the MinMaxSumCount and Histogram Aggregators. (#812)
  • Replace AlwaysParentSample with ParentSample(fallback) to match the OpenTelemetry v0.5.0 specification. (#810)
  • Rename sdk/export/metric/aggregator to sdk/export/metric/aggregation. #808
  • Send configured headers with every request in the OTLP exporter, instead of just on connection creation. (#806)
  • Update error handling for any one off error handlers, replacing, instead, with the global.Handle function. (#791)
  • Rename plugin directory to instrumentation to match the OpenTelemetry specification. (#779)
  • Makes the argument order to Histogram and DDSketch New() consistent. (#781)

Removed

  • Uint64NumberKind and related functions from the API. (#864)
  • Context arguments from Aggregator.Checkpoint and Integrator.Process as they were unused. (#803)
  • SpanID is no longer included in parameters for sampling decision to match the OpenTelemetry specification. (#775)

Fixed

  • Upgrade OTLP exporter to opentelemetry-proto matching the opentelemetry-collector v0.4.0 release. (#866)
  • Allow changes to go.sum and go.mod when running dependabot tidy-up. (#871)
  • Bump github.com/stretchr/testify from 1.4.0 to 1.6.1. (#824)
  • Bump github.com/prometheus/client_golang from 1.7.0 to 1.7.1 in /exporters/metric/prometheus. (#867)
  • Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/jaeger. (#853)
  • Bump google.golang.org/grpc from 1.29.1 to 1.30.0 in /exporters/trace/zipkin. (#854)
  • Bumps github.com/golang/protobuf from 1.3.2 to 1.4.2 (#848)
  • Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/otlp (#817)
  • Bump github.com/golangci/golangci-lint from 1.25.1 to 1.27.0 in /tools (#828)
  • Bump github.com/prometheus/client_golang from 1.5.0 to 1.7.0 in /exporters/metric/prometheus (#838)
  • Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/jaeger (#829)
  • Bump github.com/benbjohnson/clock from 1.0.0 to 1.0.3 (#815)
  • Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/trace/zipkin (#823)
  • Bump github.com/itchyny/gojq from 0.10.1 to 0.10.3 in /tools (#830)
  • Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 in /exporters/metric/prometheus (#822)
  • Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/zipkin (#820)
  • Bump google.golang.org/grpc from 1.27.1 to 1.29.1 in /exporters/trace/jaeger (#831)
  • Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 (#836)
  • Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/trace/jaeger (#837)
  • Bump github.com/google/go-cmp from 0.4.0 to 0.5.0 in /exporters/otlp (#839)
  • Bump google.golang.org/api from 0.20.0 to 0.28.0 in /exporters/trace/jaeger (#843)
  • Set span status from HTTP status code in the othttp instrumentation. (#832)
  • Fixed typo in push controller comment. (#834)
  • The Aggregator testing has been updated and cleaned. (#812)
  • metric.Number(0) expressions are replaced by 0 where possible. (#812)
  • Fixed global handler_test.go test failure. #804
  • Fixed BatchSpanProcessor.Shutdown to wait until all spans are processed. (#766)
  • Fixed OTLP example's accidental early close of exporter. (#807)
  • Ensure zipkin exporter reads and closes response body. (#788)
  • Update instrumentation to use api/standard keys instead of custom keys. (#782)
  • Clean up tools and RELEASING documentation. (#762)

statsd exporter currently relies on `LastValue` for emitting gauge metrics

The new statsd exporter looks for a LastValue aggregator to emit gauge metrics. This is problematic because the NewExportPipeline factory uses simple.NewWithExactMeasure as its aggregator selector. This selector chooses the points aggregation for Observer types.

func (selectorExact) AggregatorFor(descriptor *metric.Descriptor) export.Aggregator {
	switch descriptor.MetricKind() {
	case metric.ObserverKind:
		fallthrough
	case metric.MeasureKind:
		return array.New()
	default:
		return sum.New()
	}
}

In most cases, I would imagine those using DataDog would expect Observer results to be output as traditional gauge metrics. The recommendation here says

This also allows aggregating over time to export a distribution, but the "last" value is still well defined in each collection interval for a given label set. I imagine that an exporter that wants traditional gauge semantics could just export the sum, under the assumption that count==1, and that would be all that's needed.

However, this exporter does not consider this. Also IIUC under certain circumstances (e.g. short push interval, and low traffic) there may be situations where true histogram values come in with a single count. In that case it would be impossible to determine what is desired to be exported as a gauge, vs. what is desired to be exported as a histogram.

In light of this, the two solutions I see are to make the ExactMeasure selector choose a LastValue aggregator for the metric.ObserverKind case, or provide the ability to construct our own export pipeline with out own selector. The latter is currently not possible because Exporter.labelEncoder is not present.

If a new selector is in fact required, I think it makes sense to add to this library since the exporter expects a LastValue aggregator to be used.

@jmacd I'll defer to you here on any options I probably missed since you're most familiar in this space.

Update gRPC instrumentation

The gRPC instrumentation ...

  • should include metric instruments to capture metric events.
  • rename to not include trace in name. Likely want to follow the naming standards from the contrib instrumentation: go.opentelemetry.io/otel/instrumentation/google.golang.org/grpc (though IIRC there are more than one gRPC libraries this works with 🀷).
  • make into its own Go module to separate it from the go.opentelemetry.io/otel (specifically go.opentelemetry.io/otel/api) package.
  • investigate if this should be moved to the contrib repository.

Metric test helpers needed

This repo has a copy of the trace testing helpers from the main repository. This repo does not have a copy of the metric testing helpers. We should add test helpers to support testing metrics in this repository, but first some code should be exposed from the main repository (e.g., AsyncInstrumentState).

Update instrumentation naming conventions

Our instrumentation naming convention is well structured to find appropriate instrumentation, but the duplication of the package name is guaranteed to cause collision with the package users are instrumenting.

Options

  1. Leave it as is and let the user deal with package naming overrides.
  2. Add a suffix of otel to the declared package in the Go code, but leave the import naming (and directory structure) unchanged. This means that
    import "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux"
    
    would be named
    package muxotel
    
  3. Change the declared package name like (2), but also rename the final directory name (if it is the same as the package name) to have an otel suffix
    • go.opentelemetry.io/contrib/instrumentation/runtime -> go.opentelemetry.io/contrib/instrumentation/runtimeotel
    • go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux -> go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/muxotel
    • go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1 -> go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1 (doesn't change given the directory doesn't match the macaron package name).
  4. Change the declared package name like (2), but also add an additional directory with the instrumented library package name and a suffix of otel.
    • go.opentelemetry.io/contrib/instrumentation/runtime -> go.opentelemetry.io/contrib/instrumentation/runtime/runtimeotel
    • go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux -> go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/muxotel
    • go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1 -> go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/macaronotel

Analysis/Recommendation

Option (1) treats this as a non-issue. From user the feedback we have received and based on the conversation in today's SIG meeting, this seems like an issue.

Option (2) benefits from slightly less verbosity in the import name, but has the downside that the import name will not match the package name. This name mismatch will be undesired by new users.

Option (3) modifies the import name possibly making it slightly less clear (if you were to do a text search for instance) of a discovery process. However, it is also slightly less verbose.

Option (4) is the most verbose.

With the primary goals being:

  • Discoverability: It should be easy to search or explore the repo to find instrumentation.
  • Usability: Cause the least amount of frustration to the end user or unexpected behaviour.

I think Option (4) is the correct choice. The downside of it being verbose and therefore impacting usability seems comparatively minor to the other usability issues of the other options. Especially if, as is common, tooling is used to actually write import names.

Decide on the directory structure of the plugins directory

I was thinking how the plugins should be laid out. At first I was stripping the code hosting name, so I had go.opentelemetry.io/contrib/plugins/gorilla/mux. But I think that maybe it should just repeat the import path of the instrumented library, so basically ``go.opentelemetry.io/contrib/plugins/<IMPORT_PATH>`, like:

  • go.opentelemetry.io/contrib/plugins/github.com/gorilla/mux
  • go.opentelemetry.io/contrib/plugins/gopkg.in/macaron.v1
  • go.opentelemetry.io/contrib/plugins/database/sql

Merge the mock tracer into the otel-go's mock tracer.

The mock tracer in internal/trace is a modified copy of the mock tracer in otel-go. When we decide that our copy of mock tracer meets the needs of the instrumentation testing code (so the mock tracer stabilized) then it would be good to reduce the code duplication and bring the changes back to otel-go.

Setup vanity URL for this repo

It should be go.opentelemetry.io/contrib, I think. With that set up, we will need to change go.mod files in the repo to replace github.com/open-telemetry/opentelemetry-go-contrib part to the vanity URL.

Update CI to support integration tests

In both the mongo and cassandra instrumentation the testing requires and actual database:

Our current CI system does not stand any of these up so the testing is currently disabled. We should automate some form of testing to work with the CI system that supports these tests.

Decouple instrumentation from default SDK

Instrumentation needs to be lightweight when used. It should not have any large dependencies. However, there are multiple instrumentation packages that import the go.opentelemetry.io/otel/sdk package. Most common this is in examples or tests.

This dependency needs to be removed. It will likely depend on the resolution of open-telemetry/opentelemetry-go#872.

Usage in external projects?

What's the proper way to leverage this code in external projects? Go seems to be choking up on the contrib/replace syntax used in most of the modules files

Example:

go get -u go.opentelemetry.io/contrib/plugins/labstack/echo 
go: downloading go.opentelemetry.io/contrib v0.0.0-20200526151459-f2c18b305db9
go: downloading go.opentelemetry.io/contrib/plugins/labstack/echo v0.0.0-20200526151459-f2c18b305db9
go: go.opentelemetry.io/contrib/plugins/labstack/echo upgrade => v0.0.0-20200526151459-f2c18b305db9
go get: go.opentelemetry.io/contrib/plugins/labstack/[email protected] requires
        go.opentelemetry.io/[email protected]: invalid version: unknown revision 000000000000

I also tried a simple go get -u go get -u go.opentelemetry.io/contrib but it discovers the go.mod in plugins/labstack/echo and bombs out with the error from above

Any help would be appreciated - thanks!

Implement an Exporter for Cortex

We (@alolita, @ercl, @connorlindsey) are interested in developing a push-based exporter, sending metrics data to a Cortex instance for supporting scalable metrics storage and processing.

We plan to provide a detailed design document for review, code and tests to support this implementation. Please assign this issue to us for implementation. You can assign it to @alolita since we’re still in the process of becoming members.

We also request a mentor from the Go SDK maintainer team for this project for design and code review and guidance.

Filed by: @connorlindsey
Assigned to: @alolita

Add instrumentation for github.com/googleapis/google-cloud-go

https://github.com/googleapis/google-cloud-go

Initial packages to target:

  • bigquery
  • bigtable
  • firestore
  • pubsub
  • spanner
  • storage

Tasks

  • code complete with tests passing
  • Dockerfile with example app showing instrumentation
  • documentation updated
  • instrumentation added to the opentelemetry registry

Prior Art

OpenCensus documented support, but it looks more like instructions on how to start spans: https://opencensus.io/integrations/google_cloud/

Maybe we can do better(?)

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.