1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-04 09:43:23 +02:00
Commit Graph

63 Commits

Author SHA1 Message Date
Yuri Shkuro
aa868d506b
Clarify HTTP/gRPC exporter examples (#3492)
Signed-off-by: Yuri Shkuro <github@ysh.us>
2022-11-28 09:22:59 -06:00
Tyler Yahn
5568a30723
Add semconv/v1.12.0 (#3010)
* Add semconv/v1.12.0

* Update all semconv use to v1.12.0

Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
2022-07-13 09:55:43 -04:00
Damien Mathieu
ec33fe0fbc
add timeout to grpc connection in otel-collector example (#2939) 2022-06-02 11:18:17 -04:00
Tyler Yahn
1f5b159161
Use already enabled revive linter and add depguard (#2883)
* Refactor golangci-lint conf

Order settings alphabetically.

* Add revive settings to golangci conf

* Check blank imports

* Check bool-literal-in-expr

* Check constant-logical-expr

* Check context-as-argument

* Check context-key-type

* Check deep-exit

* Check defer

* Check dot-imports

* Check duplicated-imports

* Check early-return

* Check empty-block

* Check empty-lines

* Check error-naming

* Check error-return

* Check error-strings

* Check errorf

* Stop ignoring context first arg in tests

* Check exported comments

* Check flag-parameter

* Check identical branches

* Check if-return

* Check increment-decrement

* Check indent-error-flow

* Check deny list of go imports

* Check import shadowing

* Check package comments

* Check range

* Check range val in closure

* Check range val address

* Check redefines builtin id

* Check string-format

* Check struct tag

* Check superfluous else

* Check time equal

* Check var naming

* Check var declaration

* Check unconditional recursion

* Check unexported return

* Check unhandled errors

* Check unnecessary stmt

* Check unnecessary break

* Check waitgroup by value

* Exclude deep-exit check in example*_test.go files
2022-05-19 15:15:07 -05:00
Tyler Yahn
c05c3e237d
Add semconv/v1.10.0 (#2842)
* Add the semconv/v1.10.0 package

* Upgrade semconv used to v1.10.0

* Add changes to changelog
2022-04-22 07:41:28 -07:00
Brad Topol
8574d43509
Add semconv/v1.9.0 package (#2792)
* Add semconv/v1.9.0 package
Closes: #2756

Signed-off-by: Brad Topol <btopol@us.ibm.com>

* Updated PR number in CHANGELOG

Signed-off-by: Brad Topol <btopol@us.ibm.com>
2022-04-18 10:38:55 -07:00
Tyler Yahn
a8ea3dbb46
Replace use of old term label with attribute (#2790)
* 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
2022-04-18 07:31:31 -07:00
Tyler Yahn
1884de2b4b
Add semconv/v1.8.0 (#2763)
* 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>
2022-04-16 01:58:24 -04:00
Aaron Clawson
8849597744
Dependabot bump (#2477)
* Bump github.com/go-logr/stdr from 1.2.0 to 1.2.2

Bumps [github.com/go-logr/stdr](https://github.com/go-logr/stdr) from 1.2.0 to 1.2.2.
- [Release notes](https://github.com/go-logr/stdr/releases)
- [Commits](https://github.com/go-logr/stdr/compare/v1.2.0...v1.2.2)

---
updated-dependencies:
- dependency-name: github.com/go-logr/stdr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/go-logr/logr from 1.2.1 to 1.2.2

Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/go-logr/logr/releases)
- [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-logr/logr/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: github.com/go-logr/logr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/go-logr/stdr from 1.2.0 to 1.2.2 in /example/namedtracer

Bumps [github.com/go-logr/stdr](https://github.com/go-logr/stdr) from 1.2.0 to 1.2.2.
- [Release notes](https://github.com/go-logr/stdr/releases)
- [Commits](https://github.com/go-logr/stdr/compare/v1.2.0...v1.2.2)

---
updated-dependencies:
- dependency-name: github.com/go-logr/stdr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google.golang.org/grpc in /example/otel-collector

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google.golang.org/grpc in /exporters/otlp/otlpmetric/otlpmetricgrpc

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google.golang.org/grpc in /exporters/otlp/otlptrace

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google.golang.org/grpc in /exporters/otlp/otlptrace/otlptracegrpc

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google.golang.org/grpc in /exporters/otlp/otlpmetric

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-12-20 08:54:44 -08:00
Tyler Yahn
f1971b3f81
Use the grpc.ClientConn to handle connections for the otlptracegrpc client (#2329)
* 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>
2021-11-25 08:06:21 -08:00
Tyler Yahn
c4ba4811a2
Add semconv/v1.7.0 package (#2320)
* 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
2021-10-22 08:43:47 -07:00
Anthony Mirabella
64b640cc26
Remove old OTLP exporter (#1990)
* 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>
2021-06-11 11:18:17 -04:00
Anthony Mirabella
cdf67ddfa3
Update semantic conventions to v1.4.0, move to versioned package (#1987)
* Update semantic conventions to v1.4.0, move to versioned package

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* precommit wants explicit import path renaming for semconv/v1.4.0

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* Fix semconv import path in stdout exporter example

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-10 13:03:43 -04:00
Tyler Yahn
4883cb119d
Refactor exporter creation functions (#1985)
* Remove InstallNewPipeline/NewExportPipeline funcs

* Rename stdout NewExporter to New

* Rename prometheus NewExporter func to New

* Rename Jaeger exporter NewRawExporter func to New

* Rename zipkin exporter NewRawExporter func to New

* Rename otlp exporter creation funcs

* Rename processortest exporter creation funcs

* Update PR number in changelog

* Fix spelling error

* Rename remaining NewUnstartedExporter in otlp

* Remove unused testing file
2021-06-10 09:22:47 -07:00
Tyler Yahn
1d42be1601
Rename WithDefaultSampler TracerProvider option to WithSampler and update docs (#1702)
* 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>
2021-03-18 09:34:47 -07:00
Tyler Yahn
9c305bde9c
Flush metric events prior to shutdown in OTLP example (#1678)
* Flush metric events prior to shutdown in OTLP example

* Add changes to changelog
2021-03-10 08:19:59 -08:00
Injun Song
d75e268053
Avoid overriding configuration of tracer provider (#1633)
* 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>
2021-03-08 13:43:11 -08:00
Louis DeLosSantos
bd0bba43b5
exporter: swap pusher for exporter (#1656)
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>
2021-03-08 10:00:56 -08:00
Punya Biswal
ecf65d7968
Rename otel/label -> otel/attribute (#1541)
* Rename otel/label -> otel/attr

Leave the imported name alone, to avoid a large diff and conflicts

* Better import comment

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* otel/attr -> otel/attribute

* Missed the changelog entry

* Get rid of import renaming

* Merge remaining conflicts

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-02-18 12:59:37 -05:00
Punya Biswal
9b242bc401
Organize API into Go modules based on stability and dependencies (#1528)
* 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>
2021-02-12 08:23:51 -08:00
Joshua MacDonald
dfece3d2b9
Combine the Push and Pull metric controllers (#1378)
* 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
2021-01-13 17:07:44 -05:00
Krzesimir Nowak
8d80981465
Move gRPC driver to a subpackage and add an HTTP driver (#1420)
* 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
2021-01-11 22:55:24 -05:00
Tyler Yahn
db06c8d1cb
Flush metric events before shutdown in collector example (#1438)
Fixes #1437
2021-01-06 10:50:58 -08:00
Sam Xie
5c9221cf53
Unify endpoint API that related to OTel exporter (#1401)
* 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>
2020-12-29 11:15:57 -08:00
Krzesimir Nowak
35215264dc
Split connection management away from exporter (#1369)
* 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.
2020-12-21 12:49:45 -08:00
Krzesimir Nowak
5a728db2e9
Another batch of cleanups in otlp exporter (#1357)
* 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>
2020-11-24 11:50:05 -08:00
Krzesimir Nowak
3d6e8b5078
Move Version function and code from global to toplevel (#1330)
* Move global code to toplevel package

* Move version function to toplevel package

* Update changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 09:30:54 -08:00
Krzesimir Nowak
63a11144cf
Move baggage and propagation to separate packages (#1325)
* Move propagation code to propagation package

* Move baggage code to baggage package

* Update changelog

* Make docs of baggage.Set more clear

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-13 07:34:24 -08:00
Krzesimir Nowak
75d4911c95
Move metric code to a separate package (#1321)
* Move metrics code to metric package

* Update changelog
2020-11-12 07:28:32 -08:00
Krzesimir Nowak
3268501910
Move tracing code to trace package (#1307)
* Move tracing code to trace package

* Update changelog
2020-11-06 17:13:31 -05:00
Joshua MacDonald
187adeb251
Change resource.New() to use functional options; add builtin attributes for (host.*, telemetry.sdk.*) (#1235)
* Add a resource.Configure() with functional options

* Add a changelog

* Add tests for builtin resources

* Rename to WithoutBuiltin

* Add new test; restore environment after tests

* Apply feedback

* Apply suggestions from code review

❤️

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Comment edits

* Rename New, former method NewFromAttributes

* NewFromAttributes->NewWithAttributes

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-31 11:16:55 -07:00
Ilya Kaznacheev
a6b31e0da1
Update SpanProcessor Shutdown with context and error (#1264)
* 1232: update SpanProcessor Shutdown with context and error

* 1232: add changelog info

* 1232: fix CI error, rm commented code

* 1232: fix CI unhandled error

* 1232: Done commit properly

* Add shutdown error handling

* Merge branch 'master' into update-span-processor

* Revert now unneeded context declaration move

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2020-10-26 19:06:55 -07:00
Hui Kang
d75ccbb378
Add a Shutdown method to sdk TraceProvider (#1227)
* 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>
2020-10-26 09:20:49 -07:00
Tyler Yahn
d6dd84f6fa
Move the otel/api/global package to otel/global (#1262)
* Move otel/api/global to otel/global

* Update global package references

* Add changes to CHANGELOG
2020-10-17 10:03:48 -07:00
Tyler Yahn
818c7b14b3
Move metric api package into otel (#1252)
* 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
2020-10-17 09:48:21 -07:00
Tyler Yahn
27c84d689d
Move trace api package into otel (#1229)
* 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>
2020-10-08 19:58:56 -07:00
Tyler Yahn
6e184cd16f
Update propagation to conform with OpenTelemetry specification (#1212)
* Move propagation package contents to the otel package

* Implement package relocation

* Update propagation to OTel spec

* Add changes to changelog

* Add propagation tests
2020-10-02 12:27:16 -07:00
huikang
423c891359
Set default propagator to no-op propagator (#1204)
- 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>
2020-09-29 16:50:58 -07:00
Tyler Yahn
7d71867644
Rename *Provider names (#1190)
* 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
2020-09-23 18:16:13 -04:00
huikang
930b4d01f6
Fix missing shutdown of the batch processor (#1186)
Signed-off-by: Hui Kang <kangh@us.ibm.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-09-20 13:40:47 -04:00
Tyler Yahn
422188a85f
Correct SDK trace Exporter interface (#1078)
* 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>
2020-09-09 10:19:03 -07:00
Tyler Yahn
1ab708e4b8
Rename global SetTraceProvider and TraceProvider (#1102)
* Rename global {Set,}TraceProvider

Resolves #1101

* Rename unexported and testing vars
2020-08-31 10:02:04 -07:00
Tyler Yahn
f995380e58
Unify api/label and api/kv in new label package (#1060)
* Move `api/label` to `label`

* Move `api/kv` package contents into `label` package

* Unify label package name

* Move `api/internal/rawhelpers.go` to `internal`

* Propagate replacing `api/kv` with `label` pkg

* golint

* Fix over-aggressive change

* Update Changelog
2020-08-17 20:25:03 -07:00
Joshua MacDonald
1cdf4ee8e6
Create a export.Checkpointer API; refactor metric export pipeline test helpers (#1055)
* Add regexp filter in api/label, test

* Add regexp option to sdk.Config

* Return indistinct values only when keyRe != nil

* Filter in sdk

* Add an accumulator filter test

* SDK tests pass

* Precommit

* Undo set filters

* Backout related filter changes

* Add a new test

* Checkpoint

* Comments

* Comments in label.Set

* Lint

* Add Checkpointer

* Test refactor continues

* Refactor reducer test

* Checkpoint

* Update push_test

* Update pull controller

* Comment

* Remove pending PRs

* Remove exportertest pkg

* Revert basic changes

* Revert testing changes

* Restore processortest changes

* Precommit & comments

* Comments on pull semantics

* Comments

* Fix buggy test; incorrect expectation following error

* Finish this test

* Comments

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-13 13:12:32 -07:00
Sam Xie
f9ba15f2d1
Replace WithSyncer with WithBatcher in examples (#1044)
* Replace `WithSyncer` with `WithBatcher` in examples

* update CHANGELOG

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-08-07 09:16:43 -07:00
Tyler Yahn
96a5f8ff46
Rename api/standard package to semconv (#1016)
* Rename api/standard package to semconv

* Update `api/standard` package dependencies to `semconv`

* Update Changelog

* Add PR number to Changelog
2020-08-04 07:51:09 -07:00
Stefan Prisca
fc1ce6cb8f
fix otel collector example (#1006)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-31 11:34:46 -07:00
ET
4f3fab3ba7
Remove github.com/open-telemetry/opentelemetry-collector dependency (#943) 2020-07-16 17:18:45 -04:00
William Tong
526b815f47
Merge otlp collector examples (#841)
* Add metric instrumentation to example

* Add prometheus configs

* Add prometheus kubernetes configs

* Correct Prometheus config files

* Tweak prometheus configs

* Change instrument to Counter

* Elaborate example README

* Polish submission

* Correct otel config

* Tweak details

* Update licensing text

* Modify licensing text

* Fix typos

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-06-23 08:37:07 -07:00
Stefan Prisca
7329ccc823
Change OTLP example to use syncer (#756)
* change otlp-example to use syncer

* precommit

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-05-21 11:40:11 -07:00