* Replace use of old term label with attribute
The specification has unified on the term attribute to describe
key-value pairs. There exist still many hold-overs of the use of the
term label. This updates those uses or deprecates exported types and
functions in favor of renamed forms.
* fix infinite recursion
* Remove backticks from attribute set docs
* Remove LabelFilterSelector entirely
* Remove Metadata.Labels instead of deprecate
* Update changelog with public changes
* Revert OC err msg
* No wrap RELEASING Semantic Convention Generation section
* Initial generator
* Update template render
* Add exception and schema templates
* Add semconv/internal http unification
* Add http template
* Add licenses header
* Embed the templates
* Update static version in schema tmpl
* Add semconv-generate target to Makefile
Use this target to generate versions of the semconv packages.
* Generate semconv packages
* Update RELEASING to use make semconv-generate
* Add comments to semconvkit
* Generate semconv/v1.8.0
* Use new version of semconv
* Add changes to changelog
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* POC using the grpc.ClientConn to handle connections
* Update invalid client security test
* Update client start test for a bad endpoint
* Use any ClientConn a user provides
* Connect ReconnectionPeriod to gRPC conn retries
* Replace connection retry handling direct in otlptracegrpc
* Fix client comments
* Fix comment for NewGRPCConfig
* Replace reconnection test
* Fix grammar
* Remove unrelated changes
* Remove connection pkg
* Rename evaluate to retryable
* POC using the grpc.ClientConn to handle connections
* Replace connection retry handling direct in otlptracegrpc
* Add ClientConn use changes to changelog
* Update otlptracegrpc options
* Only close ClientConn that the Client create
* Remove listener wrapper from mock_collector_test
This is not needed now that no tests relies on the listener to wait for
a connection to be established before continuing.
* Fix spelling error
* Do not use deprecated options in the otel-collector example
* Add unit tests for retryable and throttleDelay funcs
* Add unit tests for context heredity
* Add test that exporter stop is linked to context cancel
* go mod tidy
* Update exporters/otlp/otlptrace/otlptracegrpc/client.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Fix go.mod from rebase
* Remove wrong comment about client stop closing gRPC conn
* Fix shutdown test cleanup
Do not check the second call to the client Stop. There is no guarantee
it will not error in normal operation.
* Make lint fixes
* Fix flaky unit test
Use the internals of the client to explicit cancel the context returned
from exportContext. This gets around the bug where the select in Stop
may randomly choose the non-context Done case and avoid returning an
error (also failing to cancel the context).
* Remove deprecation
To configure the client/exporter with environment variables these
options are used. There is no way to fully remove these options without
removing support for configuration with environment variables. Leave
that decision and strategy determination to a separate PR.
* Fix grammatical error in comment
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add semconv/v1.7.0 package
Generated from the v1.7.0 release of the specification using the
semconvgen tool manually. This also updates the project to use this
version of the semconv package.
This does not include the prior, and missing, v1.5.0 and v1.6.0 versions
of the semconv package. They are planned to be added in a follow-on PR.
* Update CHANGELOG.md
* Remove trace export support from exporters/otlp
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update otlp exporter example test to use metric/global package
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update CHANGELOG
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* completely excise exporters/otlp
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* 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>
* 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>
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>
* 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>
* 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.
* Move connection logic into grpcConnection object
If we will need to maintain more than one connection in future, this
splitting off will come in handy.
Co-authored-by: Stefan Prisca <stefan.prisca@gmail.com>
* Make another channel a signal channel
There is another channel that serves as a one-time signal, where
channel's data type does not matter.
* Reorder and document connection members
This is to make clear that the lock is guarding only the connection
since it can be changed by multiple goroutines, and other members are
either atomic or read-only.
* Move stop signal into connection
The stop channel was rather useless on the exporter side - the primary
reason for existence of this channel is to stop a background
reconnecting goroutine. Since the goroutine lives entirely within
grpcConnection object, move the stop channel here. Also expose a
function to unify the stop channel with the context cancellation, so
exporter can use it without knowing anything about stop channels.
Also make export functions a bit more consistent.
* Do not run reconnection routine when being stopped too
It's possible that both disconnected channel and stop channel will be
triggered around the same time, so the goroutine is as likely to start
reconnecting as to return from the goroutine. Make sure we return if
the stop channel is closed.
* Nil clients on connection error
Set clients to nil on connection error, so we don't try to send the
data over a bad connection, but return a "no client" error
immediately.
* Do not call new connection handler within critical section
It's rather risky to call a callback coming from outside within a
critical section. Move it out.
* Add context parameter to connection routines
Connecting to the collector may also take its time, so it can be
useful in some cases to pass a context with a deadline. Currently we
just pass a background context, so this commit does not really change
any behavior. The follow-up commits will make a use of it, though.
* Add context parameter to NewExporter and Start
It makes it possible to limit the time spent on connecting to the
collector.
* Stop connecting on shutdown
Dialling to grpc service ignored the closing of the stop channel, but
this can be easily changed.
* Close connection after background is shut down
That way we can make sure that there won't be a window between closing
a connection and waiting for the background goroutine to return, where
the new connection could be established.
* Remove unnecessary nil check
This member is never nil, unless the Exporter is created like
&Exporter{}, which is not a thing we support anyway.
* Update changelog
Co-authored-by: Stefan Prisca <stefan.prisca@gmail.com>
* Move global code to toplevel package
* Move version function to toplevel package
* Update changelog
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Add a Shutdown method to api TraceProvider
- sdktraceprovider shutdown span processors
- In examples, replace processosr shutdown with
traceprovider's shutdown
Signed-off-by: Hui Kang <kangh@us.ibm.com>
* remove shutdown in the api provider interface
* Add context in parameter and return error
* handle error in shutdown
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update metric Kind to InstrumentKind
* Update all the other modules with Kind rename
* Update metric Descriptor with instrument Kind rename
* Update other modules with Descriptor method rename
* Update OTLP exporter test field name
* Rename kind filenames
* Add changes to CHANGELOG
* Fix documentation for Grouping and PrecomputedSum
* Rename meter.go to metric.go
* Move descriptor.go into metric.go
* Move must.go into metric.go
* Move instruments into metric_instrument.go
* Rename metric api_test.go to metric_test.go
* Move instrumentkind_test.go into metric_test.go
* Rename sdkapi.go metric_sdkapi.go
* Move api/metric into otel
* Update to use moved packages
* Rename otel.go to error_handler.go
* Add changes to CHANGELOG
* Fix merge conflict resolution error
* Move trace API to otel
* Move tracetest to oteltest
* Update package documentation
* Remove old api/trace package
* Lint
* Add changes to CHANGELOG
* Add tests for rest of trace API
* Apply suggestions from code review
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Documentation fixes
Includes resolutions for review issues.
* Correct CHANGELOG post release
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
- add set propagator to examples
Signed-off-by: Hui Kang <kangh@us.ibm.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Rename *Provider names
There is overlap in naming with MeterProviders and TracerProviders. This
is means the specification is not implemented and these types can not
exist in the same package (#1179). This makes each type and related
functions and types explicit.
* Add changes to CHANGELOG
* Update trace export interface
Move to conforming to the specification.
* Update documentation in export trace
* Update sdk trace provider to support new trace exporter
* Update SpanProcessors
Support the Provider changes and new trace exporter.
* Update the SDK to support the changes
* Update trace Provider to not return an error
* Update sdk with new Provider return
Also fix the testExporter ExportSpans method
* Update exporters with changes
* Update examples with changes
* Update Changelog
* Move error handling to end of shutdown
* Update exporter interface
Rename to SpanExporter to match specification. Add an error return value
to the Shutdown method based on feedback. Propagate these changes.
Remove the Stop method from the OTLP exporter to avoid confusion and
redundancy.
* Add test to check OTLP Shutdown honors context
* Add Jaeger exporter test for shutdown
* Fix race in Jaeger test
* Unify shutdown behavior and testing
* Update sdk/trace/simple_span_processor.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>