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

369 Commits

Author SHA1 Message Date
Tyler Yahn
35cfbc7e87
Update precedence of event name in Jaeger exporter (#1768)
* Update precedence of event name in Jaeger exporter

The OTel specification states that the event needs to be recorded as a
log with its name set to a tag having the "event" key. That key needs to
be overridden when there is an attribute with the same key. This updates
to implement this.

Resolves #1767

* Add changes to changelog

* Update PR number in changelog

* lint
2021-04-02 07:15:20 -07:00
IrisTuntun
3947cab4be
Fix testCollectorEndpoint typo and add tag assertions in jaeger_test (#1753)
* Fix testCollectorEndpoint typo and add tag assertions in jaeger_test

* add PR number for CHANGLOG

* add tag and sevicename assetions in TestExporter_ExportSpan

* update assert.Equal to assert.Len and revert CHANGLOG

* update assert.Len to require.Len
2021-04-01 12:41:52 -04:00
Tyler Yahn
07a8d195e2
Fix Jaeger span status reporting and unify tag keys (#1761)
* Fix Jaeger span status reporting and unify tag keys

Move all tag key strings to be consts defined in a unified location.

Fix the status code and message tag keys to conform with the
specification.

Do not set the span status message if it is not set to conform with the
specification.

* Add changes to changelog

* Update CHANGELOG.md

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

* Fix misspell

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-04-01 09:27:37 -07:00
Gustavo Silva Paiva
4fa35c9092
add partial support for env var config to otlp/HTTP (#1758) 2021-04-01 09:09:41 -07:00
Gustavo Silva Paiva
bf180d0fd2
improve OTLP/gRPC connection errors (#1737)
* improve OTLP/gRPC connection errors

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-31 10:40:06 -07:00
Tyler Yahn
97501a3fee
Update SpanSnapshot to use parent SpanContext (#1748)
* Update SpanSnapshot to use parent SpanContext

Having only the parent span ID and a separate field to communicate if
the parent was remote does not provide a comprehensive view of the
parent span nor is it an efficient way to transmit this information.
Update the SpanSnapshot to have a `Parent` field that contains the
parent span context. This field replaces the ParentSpanID and
HasRemoteParent fields.

* Revert SamplingParameters span change

* Update CHANGELOG with PR number
2021-03-30 08:59:54 -07:00
dependabot[bot]
54e1bd19a0
Bump google.golang.org/api from 0.41.0 to 0.43.0 in /exporters/trace/jaeger (#1741)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.41.0 to 0.43.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.41.0...v0.43.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-28 09:34:28 -07:00
dependabot[bot]
4d25b6a270
Bump github.com/prometheus/client_golang from 1.9.0 to 1.10.0 in /exporters/metric/prometheus (#1740)
* Bump github.com/prometheus/client_golang in /exporters/metric/prometheus

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.9.0...v1.10.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-28 09:25:19 -07:00
dependabot[bot]
0a47b66f95
Bump google.golang.org/grpc from 1.36.0 to 1.36.1 in /exporters/otlp (#1739)
* Bump google.golang.org/grpc from 1.36.0 to 1.36.1 in /exporters/otlp

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.36.0 to 1.36.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.36.0...v1.36.1)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-28 09:01:17 -07:00
Kevin Schneider
a9b2f85134
upgrade thrift to v0.14.1 in jaeger exporter (#1712)
* upgrade thrift to v0.14.1 in jaeger exporter

* remove jaeger exporter vendor folder

* update PR number in changlog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-22 12:12:56 -07:00
dependabot[bot]
5a6a854d50
Bump google.golang.org/protobuf from 1.25.0 to 1.26.0 in /exporters/otlp (#1724)
* Bump google.golang.org/protobuf from 1.25.0 to 1.26.0 in /exporters/otlp

Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.25.0 to 1.26.0.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.25.0...v1.26.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MrAlias <MrAlias@users.noreply.github.com>
2021-03-22 09:26:34 -07:00
Tyler Yahn
234862136d
Migrate to using go.opentelemetry.io/proto/otlp (#1713)
Migrate to using go.opentelemetry.io/proto/otlp
2021-03-20 09:25:07 -07:00
Tyler Yahn
2b4fa9681b
Release v0.19.0 (#1710)
Update project version to v0.19.0
2021-03-19 08:36:17 -07:00
Injun Song
4beb70416e
sdk/trace: removing ApplyConfig and Config (#1693)
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.
2021-03-18 10:48:13 -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
Anthony Mirabella
860d5d86e7
Add flag to determine whether SpanContext is remote (#1701)
* Add remote property to SpanContext

* Set SpanContext.remote when extracting context in TraceContext propagator

* Ensure remote flag is set when inserting remote SpanContext into context

* Ensure tests are expecting remote flag in SpanContext where appropriate

* Update CHANGELOG.md

* Apply PR feedback

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-18 09:05:37 -07:00
dependabot[bot]
888843519d
Bump google.golang.org/api from 0.40.0 to 0.41.0 in /exporters/trace/jaeger (#1700)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.40.0 to 0.41.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.40.0...v0.41.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aneurysm9 <Aneurysm9@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-17 09:32:45 -07:00
José Carlos Chávez
345f264a13
breaking(zipkin): removes servicName from zipkin exporter. (#1697)
* breaking(zipkin): removes servicName from zipkin exporter.

Resource detector provides a serviceName in all cases, hence we can relay on span resource to obtain the serviceName. Also this is required by the spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md\#service-name (#1549).

* docs(zipkin): adds changelog.

* chore(examples/zipkin): updates example accordingly.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-03-16 13:38:48 -04:00
Sam Xie
62cbf0f240
Populate Jaeger's Span.Process from Resource (#1673)
* 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>
2021-03-16 12:04:46 -04:00
Tyler Yahn
8b1be11a54
Rename resource pkg label vars and methods (#1692)
* Rename resource pkg label vars and methods

The former `labels` package is now named `attributes` to conform with
the specification requirement. This removes the lingering `label` term
from the `resource` package.

Resolve https://github.com/open-telemetry/opentelemetry-go/issues/1691

* Update PR number in CHANGELOG

* Propagate rename to the prometheus exporter pkg
2021-03-11 11:00:12 -08:00
Anthony Mirabella
e88a091a72
Make SpanContext Immutable (#1573)
* Make SpanContext Immutable

* Adds NewSpanContext() constructor and SpanContextConfig{} struct for
constructing a new SpanContext when all fields are known
* Adds With<field>() methods to SpanContext for deriving a SpanContext
with a single field changed.
* Updates all uses of SpanContext to use the new API

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

* Update CHANGELOG.md

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

* Add tests for new SpanContext constructor and derivation

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

* Address PR feedback

* Fix new uses of SpanContext from main
2021-03-09 08:17:29 -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
dependabot[bot]
150b868d02
Bump github.com/google/go-cmp from 0.5.4 to 0.5.5 (#1667)
* Bump github.com/google/go-cmp from 0.5.4 to 0.5.5

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.4 to 0.5.5.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.4...v0.5.5)

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

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-08 12:15:49 -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
Matej Gera
05252f40d8
Jaeger Exporter: Fix minor mapping discrepancies (#1626)
* Set span status code, message and ref types according to the spec

* Serialize array attributes as string

* Use correct lib name / version key

* Add new and adjust existing tests

* Update CHANGELOG

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-08 09:32:02 -08:00
Aaron Clawson
7153ef2dc2
Add HTTP/JSON to the otlp exporter (#1586)
* Add HTTP/JSON to the otlp exporter

Co-Authored-By: Roy van de Water <72016+royvandewater@users.noreply.github.com>

* PR fixup

Co-authored-by: Roy van de Water <72016+royvandewater@users.noreply.github.com>
2021-03-05 09:59:09 -08:00
Anthony Mirabella
bb4c297eb3
Pre release v0.18.0 (#1635)
* Prepare for releasing v0.18.0

* Update CHANGELOG for v0.18.0 release

* Update CHANGELOG.md

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-03 14:40:00 -05:00
Injun Song
1519d95982
Use reasonable interval in sdktrace.WithBatchTimeout (#1621)
* Use reasonable interval in sdktrace.WithBatchTimeout

This patch resolves #1564.

* Add pull request ID to CHANGELOG.md
2021-03-01 08:03:55 -08:00
Trevor Foster
7d4496e0fe
Pass metric labels when transforming to gaugeArray (#1570)
* Pass metric labels when transforming to gaugeArray

* Update CHANGELOG.md

* Update CHANGELOG.md

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

* Add label requirements to transformed metric assertions

* Fix fmting

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-28 09:53:41 -08:00
dependabot[bot]
6d4a5e0df3
Bump google.golang.org/grpc from 1.35.0 to 1.36.0 in /exporters/otlp (#1619)
* Bump google.golang.org/grpc from 1.35.0 to 1.36.0 in /exporters/otlp

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.35.0 to 1.36.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.35.0...v1.36.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-28 09:42:59 -08:00
Punya Biswal
37688ef676
revent end-users from implementing some interfaces (#1575)
"otel/exporters/otlp/otlphttp".Option
"otel/exporters/stdout".Option
"otel/oteltest".Option
"otel/trace".TracerOption
"otel/trace".SpanOption
"otel/trace".EventOption
"otel/trace".LifeCycleOption
"otel/trace".InstrumentationOption
"otel/sdk/resource".Option
"otel/sdk/trace".ParentBasedSamplerOption
"otel/sdk/trace".ReadOnlySpan
"otel/sdk/trace".ReadWriteSpan

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-24 10:03:35 -08:00
Suraj Chafle
85e696d20b
Updating documentation with an working example for creating NewExporter (#1513)
* 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
2021-02-24 09:50:17 -08:00
Tyler Yahn
c4cf1aff6b
Fix Windows build of Jaeger tests (#1577)
* Fix Windows build of Jaeger tests

The Jaeger tests use the low-level syscall package. The Windows specific
function called in that package has a different function signature than
the unix version. Add a windows specific file using the build flags to
isolate this OS specific functionality.

* Add changes to changelog

* Blind succeed to account for unimplemented functionality on Windows
2021-02-24 07:01:29 -08:00
Tyler Yahn
4a163beaa1
Fix stdout TestStdoutTimestamp failure with sleep (#1572)
* Fix stdout TestStdoutTimestamp failure with sleep

Ensure the test condition is valid by introducing minimal sleep
durations before and after a timestamp is measured.

Resolves #1571

* Add changes to changelog

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-02-23 14:38:23 -05:00
Punya Biswal
d7aff47338
Vendor Thrift dependency (#1551)
* 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>
2021-02-19 13:12:35 -05: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
Kacper Stasik
8da5299621
fix: grpc reconnection (#1521)
* fix: grpc reconnection fixed

* chore: changelog update

* fix: grpc reconnection issue - red test

* fix: grpc reconnection #1524

* fix: grpc reconnection issue cleanup
2021-02-17 15:19:23 -05:00
Daniil Rutskiy
7de3b58ce9
Remove extra labels types (#1314)
* Remove extra labels types

Remove the following labels types: INT32, UINT32, UINT64
and FLOAT32.

Fix all extra labels types occurrences in the project.

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Update CHANGELOG.md

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Delete unused helpers

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Convert passed values into remaining types

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Clarify func description

* Fix uint64 convertion

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Fix uint conversion

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>

* Update OTLP exporter label types

Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2021-02-16 16:23:58 -08:00
dependabot[bot]
73194e44db
Bump google.golang.org/api from 0.39.0 to 0.40.0 in /exporters/trace/jaeger (#1536)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.39.0 to 0.40.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.39.0...v0.40.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-16 09:04:51 -08:00
ET
8fae0a644a
Create resource.Default() with required attributes/default values (#1507)
* Create resource.Default() with required attributes/default values

Add metric controller and tracer provider tests for resources

* Updated CHANGELOG

* PR comments

+ some small CHANGELOG PR addition, rewording
+ change default resource servicename to `unknown_service:go` (this
matches the Java codebase which uses `unknown_service:java`)
2021-02-15 12:28:37 -08:00
Tyler Yahn
76f9342277
Release v0.17.0 (#1534)
* Prepare for releasing v0.17.0

* Update CHANGELOG
2021-02-15 10:48:14 -08: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
dependabot[bot]
a6aa7f00d0
Bump google.golang.org/api from 0.38.0 to 0.39.0 in /exporters/trace/jaeger (#1517)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.38.0 to 0.39.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.38.0...v0.39.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2021-02-09 07:57:36 -08:00
Leon Wang
38efc875cf
Code Improvement - Error strings should not be capitalized (#1488)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-04 11:32:43 -08:00
Leon Wang
186c29539f
Fix golint error of package comment form (#1487)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-04 09:55:44 -08:00
dependabot[bot]
9308d6628e
Bump google.golang.org/api from 0.37.0 to 0.38.0 in /exporters/trace/jaeger (#1506)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.37.0 to 0.38.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.37.0...v0.38.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2021-02-01 10:57:14 -08:00
dependabot[bot]
7e19eb6a76
Bump google.golang.org/api from 0.36.0 to 0.37.0 in /exporters/trace/jaeger (#1504)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.36.0 to 0.37.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.36.0...v0.37.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-29 12:08:13 -08:00
dependabot[bot]
71ffba39d1
Bump google.golang.org/grpc from 1.34.0 to 1.35.0 in /exporters/otlp (#1471)
* Bump google.golang.org/grpc from 1.34.0 to 1.35.0 in /exporters/otlp

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.34.0 to 1.35.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.34.0...v1.35.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-19 12:35:26 -08:00
Joshua MacDonald
c56227771d
Histogram aggregator functional options (#1434)
* Add a Config/Option for histogram

* Just one option here

* Test fixes

* Support and test int64 histograms

* Changelog

* Lint

* Un-export three things.
2021-01-15 18:29:02 -05:00
dependabot[bot]
979ff51f22
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 (#1453)
* Bump github.com/stretchr/testify from 1.6.1 to 1.7.0

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 12:52:19 -08:00
dependabot[bot]
1df8b3b881
Bump github.com/gogo/protobuf from 1.3.1 to 1.3.2 in /exporters/otlp (#1456)
* Bump github.com/gogo/protobuf from 1.3.1 to 1.3.2 in /exporters/otlp

Bumps [github.com/gogo/protobuf](https://github.com/gogo/protobuf) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/gogo/protobuf/releases)
- [Commits](https://github.com/gogo/protobuf/compare/v1.3.1...v1.3.2)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 12:40:38 -08:00
dependabot[bot]
5a9f8f6e4e
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/stdout (#1454)
* Bump github.com/stretchr/testify in /exporters/stdout

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 11:25:33 -08:00
dependabot[bot]
7786f34cff
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/trace/zipkin (#1457)
* Bump github.com/stretchr/testify in /exporters/trace/zipkin

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 11:16:01 -08:00
dependabot[bot]
4352a7a671
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/otlp (#1460)
* Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/otlp

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 10:59:38 -08:00
dependabot[bot]
6990b3b3ea
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/metric/prometheus (#1461)
* Bump github.com/stretchr/testify in /exporters/metric/prometheus

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 10:15:00 -08:00
dependabot[bot]
7af40d2221
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 in /exporters/trace/jaeger (#1463)
* Bump github.com/stretchr/testify in /exporters/trace/jaeger

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-14 09:55:32 -08:00
Tyler Yahn
fe363be399
Move Span Event to API (#1452)
* Move Span Event to API

* Add changes to CHANGELOG
2021-01-14 09:07:25 -08:00
Anthony Mirabella
0aadfb27bc
Prepare release v0.16.0 (#1464)
* Prepare for releasing v0.16.0

* Prepare CHANGELOG for v0.16.0 release

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-01-13 20:44:06 -05: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
Joshua MacDonald
49f699d657
Remove Quantile aggregation, DDSketch aggregator; add Exact timestamps (#1412)
* Remove quantile definition

* Complete removal of Quantile-related function

* Comment in selector/simple/simple.go

* Remove 'quantile' in mmsc

* Rename array->exact

* Update changelog

* Add PR number

* Rename exact benchmark

* New test for exact timestamps

* Add timestamp tests

* More test

* From feedback

* Apply suggestions from code review

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

* Samples->Points

* Rename

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-12 10:19:13 -08:00
Eundoo Song
9c949411ce
Rename internal/testing to internal/internaltest (#1449) 2021-01-12 08:56:16 -08: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
Eundoo Song
5ed96e9244
Update exporters/otlp Readme.md (#1441) 2021-01-07 11:45:35 -08:00
Joshua MacDonald
fe9d1f7ec5
Use uint64 Count consistently in metric aggregation (#1430)
* Use uint64 Count consistently

* Number
2021-01-05 23:17:20 -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
38e76efe99
Add a split protocol driver for otlp exporter (#1418)
* Add a split protocol driver

This is a wrapper around two other protocol drivers, so it makes it
possible to send traces using a different protocol than the one used
for metrics.

* Add an example and tests for multi GRPC endpoint driver

* Update changelog

* Document the split driver
2020-12-22 09:21:45 -08:00
Matej Gera
439cd31389
Add TraceState to SpanContext in API (#1340)
* Add TraceState to API

* Add tests for TraceState

* Update related tests

- stdout exporter test
- SDK test

* Update OTLP span transform

* Update CHANGELOG

* Change TraceState to struct instead of pointer

- Adjust tests for trace API
- Adjust adjacent parts of codebase (test utils, SDK etc.)

* Add methods to assert equality

- for type SpanContext, if SpanID, TraceID, TraceFlag and TraceState are
equal
- for type TraceState, if entries of both respective trace states are
equal

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Copy values for new TraceState, adjust tests

* Use IsEqualWith in remaining tests instead of assertion func

* Further feedback, minor improvements

- Move IsEqualWith method to be only in test package
- Minor improvements, typos etc.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-21 13:11:48 -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
dependabot[bot]
add9d933f6
Bump github.com/prometheus/client_golang from 1.8.0 to 1.9.0 in /exporters/metric/prometheus (#1414)
* Bump github.com/prometheus/client_golang in /exporters/metric/prometheus

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.8.0...v1.9.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2020-12-21 08:45:02 -08:00
dependabot[bot]
83513f70f3
Bump google.golang.org/api from 0.32.0 to 0.36.0 in /exporters/trace/jaeger (#1398)
* Bump google.golang.org/api in /exporters/trace/jaeger

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.32.0 to 0.36.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/master/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.32.0...v0.36.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-14 08:21:38 -08:00
dependabot[bot]
a354fc4152
Bump github.com/prometheus/client_golang from 1.7.1 to 1.8.0 in /exporters/metric/prometheus (#1397)
* Bump github.com/prometheus/client_golang in /exporters/metric/prometheus

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.7.1...v1.8.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-14 08:16:26 -08:00
dependabot[bot]
3528e42c93
Bump google.golang.org/grpc from 1.32.0 to 1.34.0 in /exporters/otlp (#1396)
* Bump google.golang.org/grpc from 1.32.0 to 1.34.0 in /exporters/otlp

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.32.0 to 1.34.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.32.0...v1.34.0)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
2020-12-14 08:11:22 -08:00
Johannes Liebermann
c3c4273ecc
Add RO/RW span interfaces (#1360)
* Store span data directly in the span

- Nesting only some of a span's data in a `data` field (with the rest
  of the data living direclty in the `span` struct) is confusing.
- export.SpanData is meant to be an immutable *snapshot* of a span,
  not the "authoritative" state of the span.
- Refactor attributesMap.toSpanData into toKeyValue and make it
  return a []label.KeyValue which is clearer than modifying a struct
  passed to the function.
- Read droppedCount from the attributesMap as a separate operation
  instead of setting it from within attributesMap.toSpanData.
- Set a span's end time in the span itself rather than in the
  SpanData to allow reading the span's end time after a span has
  ended.
- Set a span's end time as soon as possible within span.End so that
  we don't influence the span's end time with operations such as
  fetching span processors and generating span data.
- Remove error handling for uninitialized spans. This check seems to
  be necessary only because we used to have an *export.SpanData field
  which could be nil. Now that we no longer have this field I think we
  can safely remove the check. The error isn't used anywhere else so
  remove it, too.

* Store parent as trace.SpanContext

The spec requires that the parent field of a Span be a Span, a
SpanContext or null.

Rather than extracting the parent's span ID from the trace.SpanContext
which we get from the tracer, store the trace.SpanContext as is and
explicitly extract the parent's span ID where necessary.

* Add ReadOnlySpan interface

Use this interface instead of export.SpanData in places where reading
information from a span is necessary. Use export.SpanData only when
exporting spans.

* Add ReadWriteSpan interface

Use this interface instead of export.SpanData in places where it is
necessary to read information from a span and write to it at the same
time.

* Rename export.SpanData to SpanSnapshot

SpanSnapshot represents the nature of this type as well as its
intended use more accurately.

Clarify the purpose of SpanSnapshot in the docs and emphasize what
should and should not be done with it.

* Rephrase attributesMap doc comment

"refreshes" is wrong for plural ("updates").

* Refactor span.End()

- Improve accuracy of span duration. Record span end time ASAP. We
  want to measure a user operation as accurately as possible, which
  means we want to mark the end time of a span as soon as possible
  after span.End() is called. Any operations we do inside span.End()
  before storing the end time affect the total duration of the span,
  and although these operations are rather fast at the moment they
  still seem to affect the duration of the span by "artificially"
  adding time between the start and end timestamps. This is relevant
  only in cases where the end time isn't explicitly specified.
- Remove redundant idempotence check. Now that IsRecording() is based
  on the value of span.endTime, IsRecording() will always return
  false after span.End() had been called because span.endTime won't
  be zero. This means we no longer need span.endOnce.
- Improve TestEndSpanTwice so that it also ensures subsequent calls
  to span.End() don't modify the span's end time.

* Update changelog

Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-10 21:15:44 -08:00
Tyler Yahn
61e07a0d62
Release v0.15.0 (#1392) 2020-12-10 21:00:59 -08:00
José Carlos Chávez
787e3f457a
chore(zipkin-exporter): relay on the status code for the request but still read the response body. (#1328)
* chore(zipkin-exporter): relay on the status code for the request but still read the response body.

* fix(zipkin-exporter): fix tests.

* chore(zipkin-exporter): adds changelog.

* chore: 202 -> http.StatusAccepted

Co-authored-by: Chris Bandy <bandy.chris@gmail.com>

* chore: 202 -> http.StatusAccepted

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Chris Bandy <bandy.chris@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-03 09:51:09 -08:00
dependabot[bot]
e1ff2d15cf
Bump github.com/google/go-cmp from 0.5.3 to 0.5.4 (#1374)
* Bump github.com/google/go-cmp from 0.5.3 to 0.5.4

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.3...v0.5.4)

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

* Auto-fix go.sum changes in dependent modules

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-30 10:31:41 -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
Tyler Yahn
575df22b79
Release v0.14.0 (#1355)
* Prepare for releasing v0.14.0

* Update changelog
2020-11-20 08:36:54 -08:00
Krzesimir Nowak
6eb68013b5
Some cleanups in otlp exporter (#1350)
* Drop WorkerCount option

This is not a good option - the user isn't likely to know how many
worker goroutines is optimal. This should be something that an
exporter should figure out itself. The second problem with the option
is that it is specific to the metric transformation from SDK export
format into protobuf. When the exporter starts supporting other
protocols (HTTP/JSON for example), this option may be of no use. So
the option should rather belong to the protocol, not to the
exporter. Currently both mean the same, but later they will be
separated, and this option breaks the separation.

* Make stop channel a typical signalling channel

Signalling channels are idiomatically defined as chan struct{}, so
let's make it so, to avoid confusion about the meaning of the bool
type.

* Close a race when grpc connection is closed multiple times

If several goroutines call Shutdown at the same time, then the
following scenario is possible:

goroutine A locks a mutex, reads a started member, unlocks the mutex
and gets preempted

goroutine B locks a mutex, reads a started member, unlocks the mutex
and gets preempted

goroutine A does not return early in the "if !started" conditional and
continues to close the connection and execute the rest of the function
(where it finally sets the started member to false), gets preempted

goroutine B also does not return early, because it got a copy of
started before goroutine A set it to false, so it tries to close the
connection again.

* Update changelog
2020-11-19 21:03:25 -05:00
Tyler Yahn
5b5b4ab1ea
Update OTLP to v0.6.0 (#1354)
* Update opentelemetry-proto submodule to v0.6.0

* Update generated code

* Update the OTLP exporter with new proto

* Update CHANGELOG
2020-11-19 20:57:17 -05:00
Hanshuo Tan
fd3c82bec5
support exact kind in OTLP metrics exporter (#1309)
* support exact kind in OTLP metrics exporter

* add change log

* rename function

* inline start time and end time variables

* fix test

* add test for exact int data points

* add test for exact float data points

* use newly introduced number package for numbers according to upstream change

* fix package ref
2020-11-18 14:35:37 -05: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
dependabot[bot]
20c78fed0a
Bump github.com/google/go-cmp from 0.5.2 to 0.5.3 (#1339)
* Bump github.com/google/go-cmp from 0.5.2 to 0.5.3

Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.2 to 0.5.3.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.2...v0.5.3)

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

* Auto-fix go.sum changes in dependent modules

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 09:11:53 -08:00
Andrew Hsu
27aa1f6011
update go documentation badge image (#1322)
Signed-off-by: Andrew Hsu <xuzuan@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-12 07:33:04 -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
386331a472
Prepare to move metrics code to separate subpackage (#1316)
* Move registry package under metric

* Move Number type to the metric/number subpackage

This also renames NumberKind type to Kind.

* Update changelog

* Drop outdated comment
2020-11-11 07:24:12 -08:00
Joshua MacDonald
f9984f2d4e
Support configurable AggregationTemporality in exporters; add OTLP missing sum point temporality/monotonic fields (#1296)
* Restructure ExportKindSelector helpers; eliminate PassThroughExportKind; add StatelessExportKindSelector()

* WithExportKindSelector(); Additional testing

* Changelog update

* Test the new selectors

* From review feedback

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-10 07:44:42 -08:00
Tawhid Hannan
b7508da6fa
Export non monotonic counters as gauge values from the prometheus exporter (#1269)
* Export non monotonic counters as gauge values from the prometheus exporter

* Add a test to ensure the pre-existing LastValue pathway on the collector exports the last value

* Add a TODO around refactoring the prometheus test to verify metadata as well

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-09 13:52:05 -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
José Carlos Chávez
e22a48de5a
chore: adds vanity import for files that don't have it. (#1297) 2020-11-04 09:10:58 -08: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
Tyler Yahn
034195692a
Update README and documentation to better communicate pre-GA state (#1281)
* Update README

Move project status to top of project documentation and add explicit
warnings that this project may introduce breaking changes.

* Add disclaimer to public packages docs

* Use explicit warning in README
2020-10-29 09:23:13 -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
396dd6053c
Rename Kind from the api/metric package (#1240)
* 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
2020-10-13 07:55:31 -07:00
Tyler Yahn
7ecc55581b
Update documentation for the OTLP exporter (#1242)
* Update documentation for the OTLP exporter

Update package documentation to reflect the contents of the package.

Fix lint issues by adding documentation for all exported types.

Update file comment location in otlp.go so golint does not interpret it
as package documentation.

* Apply suggestions from code review

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-10-11 19:57:50 -07:00
alrex
25ccf5a08a
Update proto v0.5.0 (#1230)
* Updating version of OTLP to 0.5.0

* updating trace transform to use latest protos

* update otlp span test

* forgot one test

* finishing the rest of the implementation

In this change:
- MetricDescriptor is no longer a member of the metric
- splitting Sum, Gauge, Histogram by Int/Float
- SummaryDataPoints are no longer around, MinMaxSumCount is now a Histogram

* update changelog

* Update CHANGELOG.md

Move changes to the Unreleased section. This is to account for the recent release.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-08 20:07:39 -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
Anthony Mirabella
9ebca887f0
Pre release v0.13.0 (#1231)
* Prepare for releasing v0.13.0

* Update CHANGELOG.md for v0.13.0 release
2020-10-08 18:18:50 -04:00