This patch removes `ApplyConfig` method and `Config` struct from
`go.opentelemetry.io/otel/sdk/trace` package. To ensure valid config
for TracerProvider, it adds `ensureValidTracerProviderConfig` private
function.
Jaeger and Zipkin have been used the `Config` directly across package
boundaries. Since `Config` is removed, they can't use it. This change,
thus, replaces `WithSDK` with `WithSDKOptions`.
Resolves#1636, #1705.
* Rename WithDefaultSampler TracerProvider option to WithSampler
The term "DefaultSampler" comes from early ideas of this project where
there would be overriding samplers lower in the trace SDK. This
overriding does not exist and if it is going to be introduced in the
future the sampler associated with the TracerProvider is already scoped
based on that association (no need to scope with a name). This renames
the TracerProvider option to not include this anachronism.
* Update PR number in CHANGELOG
* Propagate rename
* Update defaults documentation for TracerProvider
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* Jaeger exporter now populate Jaeger's Span Process from Resource
* Remove jaeger.WithProcess
* Fix tests
* Change the type of default service name into string
* Add tests
* Update CHANGELOG
* Use the API from `Set` to fetch service name in exporter
* Fix nits
* Add more test cases for jaegerBatchList function
* precommit
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* sdk/trace: add missing options to tracer provider
This change adds `WithDefaultSampler` and `WithSpanLimits` to the tracer
provider and removed `WithConfig` from it.
Before this change, `WithConfig` is the only way to set sampler or
limits of a span. However, it is prone to misuse, since `WithConfig` can
override tracing configurations that are configured by `WithResource` or
`WithIDGenerator`. Thus to fix this, it adds new functional options -
`WithDefaultSampler` and `WithSpanLimits` and removes `WithConfig`.
Resolves#1631.
* Update sdk/trace/provider.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update sdk/trace/provider.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* rebase and remove WithConfig
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* chore(zipkin): improves zipkin example to not to depend on timeouts.
* chore: improves variable name
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* chore(zipkin): makes lint happy.
* fix(zipkin): fixes example
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* fix(zipkin): import.
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
to provide consistent naming across the code base, deprecate pusher in
favor of exporter naming convention.
Signed-off-by: ldelossa <ldelossa@redhat.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Updating documentation with an working example for creating NewExporter
* Updated Changelog
* Moved examples in README to testing example
* ExampleTest shouldn't log anything if working as expected
* Fixing the lint
* Fixing the lint
* Review comments
* Changes done moved to Fixed section of Changelog
* Vendor Thrift dependency
* Fix build
* Changelog entry
* Ignore third_party for coverage purposes
* Re-run tests
* Re-run tests
* Re-run tests
* Re-run tests
* Relax time comparisons
Fixes#1559.
Some unit tests were flaking in CI because they expected the timestamp
to advance during a test, when it's possible for it to be unchanged
instead. This change switches the offending "<" comparisons to "<=".
* Re-run tests
* Relax more time comparisons
* Re-run tests
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add a tool to auto-generate replace directives
* Auto-generated changes from previous commit
* Create new modules required for trace release
* otel/metric
* otel/trace
* otel/oteltest
* otel/sdk/export/metric
* otel/sdk/metric
Relates to #1467
* Move metric-related public API out of otel/ pkg
Move GetMeterProvider, Meter and SetMeterProvider to new package
otel/metric/global in the otel/metric module.
This will allow otel/ module to be released as v1.0.
* Include PR references in CHANGELOG
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Check for root dir
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update README master branch URL to main
* Remove master branch from workflow triggers
The master branch has been renamed to main.
* Add changes to CHANGELOG
* Rename other projects default branch
All of OpenTelemetry is moving to rename `master` to `main`, this
updates all other URLs for those projects.
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Based on its module, it should be go.opencensus.io/otel/example/opencensus.
However, it's simpler to get rid of it since main packages shouldn't be imported at all.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add a Config/Option for histogram
* Just one option here
* Test fixes
* Support and test int64 histograms
* Changelog
* Lint
* Un-export three things.
* Push->basic
* Repackage
* Rename away from push
* Make exporter optional; export from a separate goroutine
* Move pull_test into controller_test
* Precommit pass
* New OTLP/Prom example
* Precommit
* Fix the example
* Shorten the example
* Test starting controller w/o exporter
* Test export timeout
* Remove ancient example & lint
* go.mod revert & tidy
* Comments
* Tidy a diff
* Tidy a diff
* Move export kind selector in the new example
* Split this test into its original parts
* Reduce diff size
* Changelog
* Remove extra Add/Done pair
* Remove unused stopCh param; document the Stop behavior
* Typo
* Use ctx
* Missed v0.15
* Apply PR feedback
* Precommit pass
* 0.14 -> 0.15 in new file
* Remove diff chunk markers
* Fix OTLP example
* Upstream
* dashpole comments
* aneurysm9 feedback
* Tidy go.sum
* Move grpc stuff to separate package
* Drop duplicated retryable status code
* Set default port to 4317
This is what the specification says for both gRPC and HTTP.
* Document gRPC option type
* Add an HTTP protocol driver for OTLP exporter
Currently it supports only binary protobuf payloads.
* Move end to end test to a separate package
It also adds some common code mock collectors can use. This will be
useful for testing the HTTP driver.
* Move export data creators to otlptest
It also extends the one record checkpointer a bit. This will be useful
for testing the HTTP driver.
* Add an HTTP mock collector and tests for HTTP driver
* Update changelog
* Do not depend on DefaultTransport
We create our own instance of the transport, which is based on
golang's DefaultTransport. That way we sidestep the issue of the
DefaultTransport being modified/overwritten. We won't have any panics
at init. The cost of it is to keep the transport fields in sync with
DefaultTransport.
* Read the whole response body before closing it
This may help with connection reuse.
* Change options to conform to our style guide
* Add jitter to backoff time
* Test TLS option
* Test extra headers
* Fix a comment
* Increase coverage
* Add a source of the backoff strategy
* Rename `otlp.WithAddress` to `otlp.WithEndpoint`
* Unify the term of the endpoint from exporter
* Update CHANGELOG
* Update example/otel-collector/main.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Switch to the full word collector
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
* Split protocol handling away from exporter
This commits adds a ProtocolDriver interface, which the exporter
will use to connect to the collector and send both metrics and traces
to it. That way, the Exporter type is free from dealing with any
connection/protocol details, as this business is taken over by the
implementations of the ProtocolDriver interface.
The gRPC code from the exporter is moved into the implementation of
ProtocolDriver. Currently it only maintains a single connection,
just as the Exporter used to do.
With the split, most of the Exporter options became actually gRPC
connection manager's options. Currently the only option that remained
to be Exporter's is about setting the export kind selector.
* Update changelog
* Increase the test coverage of GRPC driver
* Do not close a channel with multiple senders
The disconnected channel can be used for sending by multiple
goroutines (for example, by metric controller and span processor), so
this channel should not be closed at all. Dropping this line closes a
race between closing a channel and sending to it.
* Simplify new connection handler
The callbacks never return an error, so drop the return type from it.
* Access clients under a lock
The client may change as a result on reconnection in background, so
guard against a racy access.
* Simplify the GRPC driver a bit
The config type was exported earlier to have a consistent way of
configuring the driver, when also the multiple connection driver would
appear. Since we are not going to add a multiple connection driver,
pass the options directly to the driver constructor. Also shorten the
name of the constructor to `NewGRPCDriver`.
* Merge common gRPC code back into the driver
The common code was supposed to be shared between single connection
driver and multiple connection driver, but since the latter won't be
happening, it makes no sense to keep the not-so-common code in a
separate file. Also drop some abstraction too.
* Rename the file with gRPC driver implementation
* Update changelog
* Sleep for a second to trigger the timeout
Sometimes CI has it's better moments, so it's blazing fast and manages
to finish shutting the exporter down within the 1 microsecond timeout.
* Increase the timeout for shutting down the exporter
One millisecond is quite short, and I was getting failures locally or
in CI:
go test ./... + race in ./exporters/otlp
2020/12/14 18:27:54 rpc error: code = Canceled desc = context canceled
2020/12/14 18:27:54 context deadline exceeded
--- FAIL: TestNewExporter_withMultipleAttributeTypes (0.37s)
otlp_integration_test.go:541: resource span count: got 0, want 1
FAIL
FAIL go.opentelemetry.io/otel/exporters/otlp 5.278s
or
go test ./... + coverage in ./exporters/otlp
2020/12/14 17:41:16 rpc error: code = Canceled desc = context canceled
2020/12/14 17:41:16 exporter disconnected
--- FAIL: TestNewExporter_endToEnd (1.53s)
--- FAIL: TestNewExporter_endToEnd/WithCompressor (0.41s)
otlp_integration_test.go:246: span counts: got 3, want 4
2020/12/14 17:41:18 context canceled
FAIL
coverage: 35.3% of statements in ./...
FAIL go.opentelemetry.io/otel/exporters/otlp 4.753s
* Shut down the providers in end to end test
This is to make sure that all batched spans are actually flushed
before closing the exporter.