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

539 Commits

Author SHA1 Message Date
Tyler Yahn
41588fea26
Deprecate the attribute.Any function (#2181)
* Deprecate the attribute.Any func

* Update CHANGELOG.md
2021-08-13 08:57:33 -07:00
Joshua MacDonald
4e8d667f6e
Support a single Resource per MeterProvider in the SDK (#2120)
* Remove resource from export.Record

* fix bridge/opencensus

* partial fixes in exporters/otlp/otlpmetric

* Use go-cmp to simplify exporter_test

* OTLP http/grpc

* prometheus

* fix stdout (pending PR 2015)

* oc bridge cleanups

* Lint and changelog

* pr num

* cleanup

* revert

* fix multiple

* always merge the environment

* lint

* precommit

* qualify package names in changelog
2021-08-12 15:44:58 -07:00
Tyler Yahn
87d09df346
Deprecate Array attribute in favor of *Slice types (#2162)
* Deprecate Array attribute in favor of *Slice types

* Use new attr types in Jaeger exporter

* Use slice attr types in otlpmetric

* Use slice attr types in otlptrace

* Use slice attr types in zipkin exporter

* Remove array attr test from deprectated oteltest func

* Use StringSlice for cmd arg resource attr

* Add changes to the changelog

* Remove use of deprecated Array func
2021-08-12 08:05:42 -07:00
Joshua MacDonald
df384a9a33
Move InstrumentKind into the new metric/sdkapi package (#2091)
* Move InstrumentKind into the new metric/sdkapi package

* remove the alias

* remove the alias (everywhere)

* Changelog

* Add a test

* merge updates

* fix changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-08-11 16:02:28 -07:00
Tyler Yahn
5d25c4d20e
Add support for int32 in attribute.Any (#2169)
* Support int32 for Any func in attribute pkg

* Add changes to changelog

* Update PR number in CHANGELOG.md
2021-08-11 09:32:00 -07:00
Tyler Yahn
a3d4ff5c0c
Deprecated the bridge/opencensus/utils package (#2166)
* Deprecated the bridge/opencensus/utils package

* Update PR number in CHANGELOG.md

* Apply suggestions from code review
2021-08-09 11:33:25 -07:00
Tyler Yahn
56c743ba79
Allow global ErrorHandler to be set multiple times (#2160)
* Add benchmarks for error handler

* All multiple global ErrorHandler sets

* Use ioutil instead of io for Discard

* Add changes to changelog

* Add unit tests for delegation
2021-08-06 10:05:32 -07:00
Koenraad Verheyden
21d4686f4f
Add ErrorHandlerFunc to simplify creating ErrorHandlers (#2149)
* Add ErrorHandlerFunc to simplify creating ErrorHandlers

* Add CHANGELOG entry

* Apply suggestions from code review

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

* Add interface assertion

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-08-03 15:15:54 -07:00
Robert Pająk
fd7c327b55
Fix Jaeger exporter agent port default value and docs (#2131)
* Fix Jaeger exporter agent port default value and docs

* Update changelog

* Revert example
2021-07-29 13:48:04 -04:00
Sean Schade
b8561785c0
fix(2138): add guard to constructOTResources to return an empty resource (#2139)
* fix(2138): add guard to constructOTResources to return an empty resource when attributes are not supplied

Fixes: https://github.com/open-telemetry/opentelemetry-go/issues/2138

* Update CHANGELOG.md

Co-authored-by: Robert Pająk <pellared@hotmail.com>

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-07-29 10:09:07 -07:00
Tyler Yahn
11f62640ee
Add a SpanRecorder to the sdk/trace/tracetest (#2132)
* Add a SpanRecorder to the sdk/trace/tracetest

* Add changes to changelog

* Run make precommit

* Rename tests
2021-07-29 10:00:58 -07:00
Anthony Mirabella
7939841868
pre-release v1.0.0-RC2 (#2133)
* update versions for 1.0.0-RC2

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

* Prepare for versions v1.0.0-RC2

* Update CHANGELOG

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-07-26 15:09:33 -04:00
Tyler Yahn
bbe6ca40a7
Deprecate oteltest.Harness for removal (#2123)
* Deprecate oteltest.Harness for removal

* Add changes to changelog

* Alias oteltest.Harness to internaltest

* Update oteltest/tracer_test.go

remove `oteltest` import.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-07-26 11:40:36 -04:00
Tyler Yahn
7a624ac21c
Deprecated the oteltest.TraceStateFromKeyValues function (#2122)
* Deprecated the oteltest.TraceStateFromKeyValues func

* Update changelog

* make precommit
2021-07-26 11:12:53 -04:00
Nelson Ghezzi
ece1879fae
Removed dropped link's attributes field from API package (#2118)
* Removed DroppedAttributeCount field from Link struct

* Reintroduced DroppedAttributeCount with a wrapper struct

* Added Link type in otel/sdk package and used it instead of Trace API equivalent

* Added changelog entry

* Linting fix in changelog

* Deleted duplicated changelog section added by mistake

* Expanded changelog entry and moved it under the 'Added' section

* Explicitly mentioned otel/trace library in changelog entry under 'Removed' section to avoid ambiguity
2021-07-26 11:06:41 -04:00
Tyler Yahn
cb607b0ab1
Unify OTLP exporter retry logic (#2095)
* Add retry internal package

* Use retry package in connection

* Use retry package for otlpconfig

* Use the retry package in otlptracegrpc

* Use the retry package in otlptracehttp

* Add changes to CHANGELOG

* Lint internal

* Update otlptracehttp tests

* Update dependencies

* Add retry tests to otlptracehttp

* Remove TestRetry from otlptracehttp
2021-07-22 15:07:38 -07:00
Bhautik Pipaliya
abe2243718
API: create new linked span from current context (#2115)
* API: create new linked span from current context

* ran make precommit

* Update trace/trace.go

* Updated CHANGELOG

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-07-22 11:39:27 -07:00
Tyler Yahn
7f10ef72d4
Remove propagation testing types from oteltest (#2116)
* Add propagationtest package

* Update internal/global to use propagationtest

* Move propagationtest into internal
2021-07-22 08:16:57 -07:00
csuzhang
25d739b0a0
Remove resource.WithBuiltinDetectors() which has not been maintained (#2097)
* remove resource.WithBuiltinDetectors() which has not been maintained

* add changelog file

* Update CHANGELOG.md

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>

* resolved a repeated conflict

* fix unittest error

* fix unittest error

* fix the PR according to suggestion

* fix unittest fail and del repeated testcase in CI system

* Update CHANGELOG.md

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

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-07-22 06:47:09 -07:00
Joshua MacDonald
d57c5a5604
Remove several metrics test helpers (#2105)
* Remove several metrics test helpers

* Lint

* Changelog

* Lint
2021-07-21 13:06:38 -04:00
Tyler Yahn
49359495c7
Simplify trace_context tests (#2108)
* Simplify trace_context tests

Refactor the propagation/trace_context tests to be targeted at testing
the propagator functionality only and remove extraneous dependencies.

Fix the TraceContext Inject method from injecting the tracestate header
if no value exists.

* Add changes to changelog
2021-07-21 09:15:40 -07:00
Tyler Yahn
63dfe64aae
Correct status transform in OTLP exporter (#2102)
* Correct status transform in OTLP exporter

* Add changes to changelog
2021-07-20 09:06:18 -07:00
Tyler Yahn
ab78dbd05b
Update release URL (#2106) 2021-07-20 11:34:08 -04:00
Anthony Mirabella
647af3a0f9
Pre release experimental metrics v0.22.0 (#2101)
* update metrics version set

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

* Prepare for releasing v0.22.0

* Update CHANGELOG for metrics v0.22.0 release

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

* Fixup CHANGELOG linking

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-07-19 16:59:45 -04:00
Nelson Ghezzi
0a56233717
Fixed OS type value for DragonFly BSD (#2092)
* Added explicit mapping between GOOS and semconv OS type attribute value

* Added tests for OS type mappings

* Added changelog entry

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-07-19 11:40:30 -04:00
Anthony Mirabella
12f737c7a5
oteltest: ensure valid SpanContext created for span started WithNewRoot (#2073)
* oteltest: ensure valid SpanContext created for span started WithNewRoot

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

* Add CHANGELOG entry

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-07-09 13:01:44 -07:00
Nelson Ghezzi
484258eb36
OS description attribute detector (#1840)
* Added Linux-specific detector for the os.description attribute

* Generalized OS description detector with placeholder function for unimplemented OSes

* Extended osDescription function to *nix OSes based on golang.org/x/sys/unix

* Added WithOS resource configuration function to configure all of the OS resource attributes

* Implemented osDescription funtion for Windows OS

* Improved documentation header for *nix version of the osDescription function

* Added support for reading os-release file

* Added/updated documentation headers for *nix implementation of osDescription and related functions

* Changelog update

* Added support for reading macOS version information

* Mock approach to test OS description attribute

* Extracted common function getFirstAvailableFile to read the first available file from a list of candidates

* Upgraded golang.org/x/sys

* Changelog update

* Fixed wrong function name in documentation header for WithOSDescription

* Updated documentation header for platformOSDescription function

* Renamed restoreProcessAttributesProviders test helper function

The function restoreProcessAttributesProviders was renamed to simply
restoreAttributesProviders to better reflect its broader scope, which
not only applies to process attribute's providers.

* Fixed os_linux.go overriding build tags defined inside the file

The suffix on os_linux.go was overriding the build tags already defined
in that file. The file was renamed to os_release_unix.go, reflecting
the main function defined in the file.

For consistency, os_darwin.go was renamed to os_release_darwing.go, as
its primary purpose is to also define the osRelease function.

* Removed use of discontinued function resource.WithoutBuiltin

* Added PR number to changelog entries

* Updated go.sum files after run of make lint

* Linux implementation: ignore lines with an empty key

* Linux implementation: avoid unquoting strings less than two chars

* WIP: added tests for Linux support functions

* WIP: added tests for charsToString and getFirstAvailableFile functions

* Replaced os.CreateTemp with ioutil.TempFile as the former only exists in Go 1.16

* Added unameProvider type to decouple direct reference to unix.Uname function inside Uname()

* Added tests for Uname() function

* Replaced *os.File with io.Reader in parseOSReleaseFile to ease testing

* Added tests for parseOSReleaseFile function

* Darwin implementation: added tests for buildOSRelease function

* Replaced *os.File with io.Reader in parsePlistFile to ease testing

* Darwin implementation: added tests for parsePlistFile function

* Type in documentation header for Linux osRelease function

* Extracted logic for reading specific registry values into helper functions

* Added basic tests for Windows version of platformOSDescription and helper functions

* Manually formatted uint64 to strings to have an uniform interface for test assertions

* Asserts there's no error when opening registry key for testing

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Simplified subtests by using a single test with multiple asserts

* go.sum update after running make

* Fix typo

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

* WIP: added placeholder implementation of platformOSDescription for unsupported OSes

* Fixed typo on osRelease documentation header

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

* Fixed typo on test case name for ParsePlistFile tests

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

* Linter fix in changelog

* go.sum updates after running make

* Used strings.Replacer instead of multiple strings.ReplaceAll calls

* Optimized implementation of charsToString

* Safer temporary file deletion with t.TempDir()

* Used t.Cleanup() for safer mocking of runtime providers in OS resource tests

* Handled optionality of DisplayVersion registry key.

For example, CI machine runs on:
Windows Server 2019 Datacenter (1809) [Version 10.0.17763.1999]

So, to not add an extra white space due to missing DisplayVersion,
this value is checked to be not empty, and only in such case a
trailing space is added for that component.

* Workaround to handle the case of DisplayVersion registry key not present

* Excluded unsupported GOOSes by negation of supported ones

* go.sum update after running make

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Chris Bandy <bandy.chris@gmail.com>
2021-07-08 13:35:27 -07:00
David Ashpole
9e8f523d75
when using WithNewRoot, don't use the parent context for sampling (#2032)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-28 09:17:12 -07:00
coryb
16f83ce689
export ToZipkinSpanModels for use outside this library (#2027)
* export ToZipkinSpanModels for use outside this library

* Update CHANGELOG.md
2021-06-23 18:30:15 -04:00
csuzhang
d5d4c87f6d
Add HTTP metrics exporter for OTLP (#2022)
* add HTTP support for OTLP metrics exporter

* add to changelog

* fix unit test not covered before

* add otlpmetrichttp module to .github/dependabot.yml

* add test file for client.go

* run make commit to clean repository

* fix err occurs in TestCancelledContext

* fix err in TestCancelledContext which is nil

* fix err in TestCancelledContext which is nil, occurs occasionally

* fix unittest err in TestCancelledContext which occurs occasionally

* fix ineffectual assignment to err when running lint

* Update CHANGELOG.md

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

* Update exporters/otlp/otlpmetric/otlpmetrichttp/doc.go

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

* Update exporters/otlp/otlpmetric/otlpmetrichttp/doc.go

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

* del options that not used in http exporter metrics

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-22 11:45:17 -07:00
Tyler Yahn
51dbe3cb41
Remove deprecated exporters (#2020)
* Remove deprecated exporters

* Remove codecov config entry for Jaeger exporter

* Remove exporters from dependabot config
2021-06-19 17:29:56 -04:00
Anthony Mirabella
ced177b795
Pre-release 1.0.0-RC1 (#2013)
* Add versions.yaml to specify module version sets
* Prepare for releasing v1.0.0-RC1
* Update experimental-metrics and bridge module sets to v0.21.0
* Prepare for releasing v0.21.0
* Fixup go.mod version references
* Update version.go
* Update CHANGELOG
* Update godoc references to "pre-GA phase" for RC1 packages
* Update website_docs for 1.0.0-RC1

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-06-18 11:22:16 -04:00
Anthony Mirabella
39fe8092ed
Add span.TracerProvider() (#2009)
* Ensure that no-op tracer still progates non-recording spans

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

* Add `TracerProvider` to the `trace.Span` interface

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

* Remove config from oteltest.Tracer as it can be accessed through the provider

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-06-17 12:05:44 -04:00
Anthony Mirabella
c30cd1d0fd
Split stdout exporter into stdouttrace and stdoutmetric (#2005)
* Split stdout exporter into stdouttrace and stdoutmetric

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

* Remove unused options from stdouttrace and stdoutmetric exporters

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

* Update stdout exporter references in website docs

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

* Update docs to include correct import paths, properly describe exporter scope

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

* Remove pointless options to disable signals from what are now single-signal exporters

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-06-16 11:32:42 -04:00
Tõnis Tiigi
80ca2b1ea1
otlp: mark unix endpoints to work without transport security (#2001)
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-15 14:10:52 -07:00
Tyler Yahn
3be9813d56
Deprecate the exporters in the "trace" and "metric" sub-directories (#1993)
* Rename exporters/metric/prometheus

* Rename exporters/trace/jaeger

* Rename exporters/trace/zipkin

* Fix dependabot config and make test

* Update README docs

* Deprecate exporters instead of remove them

* Update dependabot with old modules

* Run crosslink

* Add lint override for known deprecated pkg

* Update PR number
2021-06-12 11:39:22 -07:00
Gustavo Silva Paiva
b33edaa552
OTLP metrics gRPC exporter (#1991)
* OTLP metrics gRPC exporter

* add newline

* address comments
2021-06-11 13:25:56 -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
7728a52135
Remove dependency on metrics packages (#1988)
* Declare internal/metric module to version it separately

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

* Remove dependency on metrics module from soon-to-be-stable modules

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

* Add PR ID to CHANGELOG

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

* rename metric/oteltest to metric/metrictest

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

* Fix metrictest package name in CHANGELOG

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-06-10 15:05:25 -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
Tigran Najaryan
46d9687a35
Add Schema URL support to Resource (#1938)
This implements specification requirement:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-creation

- Changes `resource.NewWithAttributes` to require a schema URL. The old function
  is still available as `resource.NewSchemaless`. This is a breaking change.
  We want to encourage using schema URL and make it a conscious choice to have a
  resource without schema.

- Merge schema URLs acccording to the spec in resource.Merge.

- Several builtin resource detectors now correctly populate the schema URL.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-08 09:46:42 -07:00
csuzhang
208860127a
Bugfix jaeger exporter test panic (#1973)
* fix jaeger exporter test panic with close closed channel

* add change to CHANGELOG.md

* Update CHANGELOG.md

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-06-08 08:34:43 -07:00
Tyler Yahn
4bf6150fa9
Add baggage implementation based on the W3C and OpenTelemetry specification (#1967)
* Rename baggage context file

* Initial baggage implementation

* Initial tests

* More tests

* Update baggage context functionality

* Add New method to baggage pkg

* Update namedtracer example

* URL encode baggage values

* Refactor and use internal baggage pkg

* Update OpenTracing bridge

* Update baggage propagator

* Fix lint and test errors

* Add changes to changelog

* Apply suggestions from code review

* Rename testcase field per suggestion

* Update test to verify last-one-wins semantics

* Explicitly seed random numbers with static seed in tests

* Parse Member key/value with string split

* Add test for member parse with equal signs in value

* Trim whitespaces for member key/value
2021-06-08 08:06:37 -07:00
Gustavo Silva Paiva
2371bb0a09
add otlp trace http exporter (#1963)
* add otlp trace http exporter

* remove `WithTraces*` options

* address discussions

* run make precommit

* rename WithURLPath option
2021-06-07 07:57:58 -07:00
Anthony Mirabella
a75ade4edb
sdk/resource: honor OTEL_SERVICE_NAME in fromEnv resource detector (#1969)
* sdk/resource: honor OTEL_SERVICE_NAME in fromEnv resource detector

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

* go fmt is still my friend, even if I forget about it occasionally

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

* Fix import ordering

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-06-04 11:19:15 -07:00
Gustavo Silva Paiva
dfe2b6f143
OTLP trace gRPC exporter (#1922)
* draft: otlp exporter trace grpc

* address comments and improve usability

* change passthrough example to go 1.15

* code cleanups

* copy dependencies to `otlptrace`

* fix typo on makefile

* address comments

* update code with latest changes

* fix comments

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-05-27 13:47:01 -07:00
Tigran Najaryan
bd935866f4
Add schema URL support to Tracer (#1889)
This adds support for schema URL to the Tracer according to the specification:
https://github.com/open-telemetry/opentelemetry-specification/pull/1666
(Link to replaced by the link to the spec after that PR is merged)

For the future: once the proto is updated we will need to populate the
schema_url field in the messages.
2021-05-27 15:22:38 -04:00
Aaron Clawson
c1f460e097
Update API configs. (#1921)
* Added Reason to Contributing and Updated TracerConfig

* PR comment fixup

* Changed how span Options work.

* Fix Markdown linting

* Added meter configs.

* Fixes from PR comments

* fix for missing instrument

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-05-27 07:53:56 -07:00
Tyler Yahn
0eeb8f87e9
Refactor Tracestate (#1931)
* Refactor TraceState

* Update tracecontext propagator to use new TraceState

* Add TraceStateFromKeyValues to oteltest

* Use oteltest to test TraceState

* Replace IsEmpty with Len for TraceState

* Replace ParseTraceState with ParseTraceStateString

* Clean up naming

* Add immutability test for TraceState

* Add changes to changelog

* Fixes

* Document argument type change in changelog

* Address feedback

Remove circularity of TestTraceStateLen.
2021-05-24 07:53:26 -07:00
David Ashpole
d3b1280863
Add Passthrough example (#1912)
* Add passthrough example

* Update example/passthrough/handler/handler.go

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

* Update example/passthrough/README.md

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

* Apply suggestions from code review

Co-authored-by: Robert Pająk <pellared@hotmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
2021-05-18 14:03:10 -07:00
Robert Pająk
d23cc61b93
Refactor configs (#1882)
* trace: Refactor sampling config

* tracer: Refactor TracerProviderConfig

* Update the changelog

* Refactor sdk/metric/controller/basic config

* Refactor sdk/metric/processor/basic config

* Refactor sdk/resource config

* Refactor oteltest config

* Refactor exporters/otlp configs

* Refactor exporters/stdout config

* Refactor exporters/trace/jaeger configs

* Refactor exporters/trace/zipkin config

* Unexport stdout.NewConfig

* Refactor zipkin.go

* Refactor provider.go
2021-05-14 13:28:28 -07:00
Tyler Yahn
6324adaa66
Add tracer option argument to global Tracer function (#1902)
* Add tracer opt arg to global Tracer func

* Update PR number
2021-05-13 14:43:19 -07:00
Anthony Mirabella
035fc650a2
Do not include authentication information in the http.url attribute (#1919)
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-05-13 13:05:44 -04:00
Marco Hofstetter
21c1641831
Add support for scheme in OTEL_EXPORTER_OTLP_ENDPOINT (#1886)
* Add support for scheme in OTEL_EXPORTER_OTLP_ENDPOINT according to the spec

* Changes after review from pellared

* Changes after review from pellared - 2

* Changes after review from pellared - 3

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-05-12 19:17:37 -04:00
Anthony Mirabella
5cb6263624
Semantic Convention generation tooling (#1891)
* Add semantic convention generator

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

* Update semantic conventions from generator

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

* Use existing internal/tools module

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

* Fix lint issues, more initialisms

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

* Update changelog

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

* semconvgen: Faas->FaaS

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

* Fix a few more key names with replacements

* Update replacements from PR feedback

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

* rename commonInitialisms to capitalizations, move some capitalizations there

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

* Regenerate semantic conventions with updated capitalizations and replacements

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

* Generate semantic conventions from spec v1.3.0

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

* Cleanup semconv generator util a bit

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

* No need to put internal tooling additions in the CHANGELOG

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

* Fix HTTP semconv tests

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

* Add semconv generation notes to RELEASING.md

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-05-12 19:10:56 -04:00
Tyler Yahn
6219221fc5
Move the unit package to the metric module (#1903) 2021-05-12 11:51:26 -07:00
Tyler Yahn
63e0ecfc22
Implement global default non-recording span (#1901)
* Remove the Tracer method from the Span API

* Update CHANGELOG with changes

* Update CHANGELOG.md

* Fix misspell

* Address feedback

* Implement global default non-recording span

* Add changes to CHANGELOG

* Update PR number in changelog
2021-05-12 13:11:56 -04:00
Tyler Yahn
b6d5442ff6
Remove the Tracer method from the Span API (#1900)
* Remove the Tracer method from the Span API

* Update CHANGELOG with changes

* Update CHANGELOG.md

* Fix misspell

* Address feedback
2021-05-12 11:19:50 -04:00
Robert Pająk
cabf0c0782
Fix default Jaeger collector endpoint (#1898)
* Fix default Jeager collector endpoint

* Update CHANGELOG.md
2021-05-11 21:20:16 -04:00
Gábor Lipták
d20e722830
CI builds validate against last two versions of Go, dropping 1.14 and adding 1.16 (#1865)
Signed-off-by: Gábor Lipták <gliptak@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-05-06 17:14:11 -04:00
Tyler Yahn
cbcd4b1a3d
Redefine ExportSpans of SpanExporter with ReadOnlySpan (#1873)
* Remove TODO from ReadOnlySpan interface

* Remove the Tracer method from the ReadOnlySpan

This is not required by the specification nor the use of this interface.

* Remove IsRecording from the ReadOnlySpan interface

A read-only span value does not need to know if updates to it will be
recorded. It by definition cannot be updated so no point in
communicating if an update would be recorded.

* Document the ReadOnlySpan interface

* Rename messageEvent* to just event*

* Move the SpanSnapshot into its own file

* Update ReadOnlySpan interface with meta info methods

Add the DroppedAttributes, DroppedLinks, DroppedEvents, and
ChildSpanCount methods to the interface to return additional information
about the span not specified by the specification, but that we are
already providing.

* Add SpanStub to the sdk/trace/tracetest pkg

* Redefine ExportSpans of SpanExporter with ReadOnlySpan

* Rename SpanSnapshot to snapshot and purge docs

* Remove Snapshot method from snapshot type

This method is a hold-over from previous version of the ReadOnlySpan
interface is not needed.

* Update CHANGELOG with changes
2021-05-04 16:45:13 -07:00
Alex
c99d5e999c
Split large jaeger span batch to admire the udp packet size limit (#1853)
* Split large jaeger span batch to admire the udp packet size

* Refactory EmitBatch and produce complaining error msg when serialization fails

* Add tests for large jaeger spans
Update CHANGELOG.md

* Update CHANGELOG.md

* Fix compatibility-test on windows.

* Add test case for exporting spans with multiple errors.
2021-05-04 14:31:41 -04:00
Iris Song
42a845093e
Unembed SpanContext (#1877)
* Unembed SpanContext

rebase branch

* Update CHANGELOG
2021-05-03 20:10:02 -04:00
Tyler Yahn
b7d02db147
Add Status type to SDK (#1874)
Add Status type to SDK

Use this type to encapsulate the Span status similar to the Event type
encapsulating a Span event and the Link type a span link.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-05-03 12:00:54 -07:00
Tony Li
a1349944c0
Update resource.go (#1871)
* Update resource.go

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-05-03 09:50:36 -07:00
Gustavo Silva Paiva
2bd4840c30
remove Set.Encoded(Encoder) enconding cache (#1855)
* remove Set.Encoded(Encoder) enconding cache

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-29 11:28:04 -07:00
Aaron Clawson
7674eebf56
Removed different types of Detectors for Resources. (#1810)
* Removed different types of Detectors for Resources.

This change simplifies different types of collectors into one list. The
order of this list determines how they are applied.  Defaults are
applied when the user does not supply any detectors.  To achieve
default behavior and additional behavior a DefaultDetectors struct has been
created

* missed prometheus test.

* Changed behavior around WithDetectors(nil)

Added examples of use of WithDetectors.

* Added NoOp example

* Changed test to reflect acutal default case

This changes because WithDetector() no longer is the same as not using WithDetector()

* Unexports the noOp detector

* Updated changelog

* Fixes to spelling mistakes.

* Added NewEmptyResouce and unexported builtin detectors

* Fix for prometheus example

* Resource has two Rs

I need to get a new R key it seems.

Co-authored-by: Sam Xie <xsambundy@gmail.com>

* Replaced NewEmptyResource() with New()

* Fix test function name

* Comment fixups.

* Apply suggestions from code review

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

Co-authored-by: Sam Xie <xsambundy@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-29 11:12:48 -07:00
Gustavo Silva Paiva
f92a6d8361
Implement retry policy for the OTLP/gRPC exporter (#1832)
This was heavily inspired by the retry policy from the https://github.com/open-telemetry/opentelemetry-collector code.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-29 11:07:21 -07:00
Tyler Yahn
8e55f10ad5
Move the Event type from the API to the SDK (#1846)
* Move the Event type from the API to the SDK

This type is not used in the API. It is used in the SDK and then through
the processing pipelines. Move it to the package that originates its use.

* Add changes to changelog

* Update CHANGELOG.md

Co-authored-by: Gustavo Silva Paiva <guustavo.paiva@gmail.com>

Co-authored-by: Gustavo Silva Paiva <guustavo.paiva@gmail.com>
2021-04-29 10:29:48 -07:00
Gustavo Silva Paiva
e399d355cb
drop failed to exporter batches and return error when forcing flush a span processor (#1860)
* drop failed to exporter batches and return error when forcing flush a span processor

* changelog

* changelog

* change should export condition

* cleanup
2021-04-29 09:42:11 -07:00
Tyler Yahn
f6a9279a86
Honor context deadline or cancellation in SimpleSpanProcessor.Shutdown (#1856)
* Honor context Done in SSP Shutdown

* Update PR number in changelog

* Update comment

* Add tests

* Make tests more concise

* Restructure tests for readability
2021-04-28 10:15:00 -07:00
Jerry You
cb0972504e
fixed typo (#1857) 2021-04-28 07:57:33 -07:00
Tyler Yahn
62cd933da5
Handle Resource env error when non-nil (#1851)
* Handle Resource env error when non-nil

* Add changes to changelog

* Update PR number
2021-04-27 09:52:48 -07:00
Tyler Yahn
ca130e54e8
Markdownlint (#1842) 2021-04-26 08:42:41 -07:00
ET
1144a83dce
Small typo fixes to existing CHANGELOG entries (#1839)
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-04-24 17:02:36 -04:00
bryan-aguilar
0f4e454c91
Change NewSplitDriver paramater and initialization (#1798)
* Change NewSplitDriver paramater and initialization

* Update CHANGELOG.md

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

* Update CHANGELOG.md

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Move splitdriver option into options.go and rename

* Update CHANGELOG.md

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

* Change option name and nil test to snapshots

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/protocoldriver.go

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

* Update exporters/otlp/options.go

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

* Update exporters/otlp/options.go

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

* Update exporters/otlp/options.go

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

* Update exporters/otlp/options.go

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

* Change SplitDriverOption to match spec

* Update changelog entry

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-23 14:51:55 -04:00
Tyler Yahn
02d8bdd5d9
Release v0.20.0 (#1837)
* Prepare for releasing v0.20.0

* Update changelog

* Add version validation test

* lint
2021-04-23 11:19:07 -07:00
Nelson Ghezzi
aa66fe75e4
OS and Process resource detectors (#1788)
* WIP: OS and Process resource detectors

* Completed documentation headers

* Added empty test files for OS and Process resource functions

* Split long line

* Added resource.WithOS function test

* Added resource.WithProcess* functions tests

* Renamed osDetector and WithOS function to better reflect they only add the os.type attribute

* Updated changelog

* WIP: possible use of wrappers for getting attribute values

* Refined implementation of wrapper functions providing os/runtime/user information

* Added PR number to new changelog entries

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

* Fix wrong function name in documentation header

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

* Fixed wording in WithProcessOwner documentation header

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

* Updated osTypeDetector

* Replaced ToUpper with ToLower to match the current convention.
* Used runtimeOS provider to get the OS name.

* Adapted WithOSType test to mock runtime providers

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-23 08:28:13 -07:00
Tyler Yahn
0fdc3d78a2
Remove bundler from Jaeger exporter (#1830)
* Remove bundler from Jaeger exporter

* Update dependencies

* Add changes to changelog

* Add PR number to changelog
2021-04-22 10:47:27 -04:00
Sai Nadendla
e43d9c00bc
Update Default Value for Jaeger Exporter Endpoint (#1824)
* Update Default Value for OTEL_EXPORTER_JAEGER_ENDPOINT Env Var

* update comments

* fix documentation

* update CHANGELOG

* add missing tab

* fix lint issue

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-04-21 15:02:06 -04:00
Dhruv Vora
0032bd6499
Fix default merging of resource attributes from environment variable (#1785)
* updated controller to merge default resource with environment resource

* updated TracerProvider to merge default resource with environment resource

* Added Changelog entry

* Added resource.Environment(), modified resource.Default() for environment vairable and WithResource() configuration for TracerProvider and Controller

* Update CHANGELOG.md

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

* Moved environment detector to defaultResource initialization, added test cases

* Changes to default resource initialization

* made changes to the test cases

* added merging of resource with environment resource

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-04-21 14:53:12 -04:00
Tyler Yahn
543c8144b9
Remove the WithSDKOptions from the Jaeger exporter (#1825)
* Remove the WithSDKOptions from the Jaeger exporter

* Lint

* Setup SDK in Jaeger example
2021-04-20 16:48:34 -07:00
Gustavo Silva Paiva
70bc9eb391
Adds support for timeout on the otlp/gRPC exporter (#1821)
* initial support for timeout on otlp grpc exporter

* fix tests

* run make

* update changelog

* update changelog

* apply suggestions

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-20 10:02:02 -07:00
Tyler Yahn
081cc61d98
Update Jaeger exporter convenience functions (#1822)
* Update Jaeger exporter convenience functions

* Update changelog PR numbers

* Update CHANGELOG.md

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

* Revert removed raw exporter test

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-04-20 09:31:59 -07:00
Tyler Yahn
1b9f16d3af
Remove the WithDisabled option from Jaeger exporter (#1806)
* Remove the WithDisabled option from Jaeger exporter

* Update PR number
2021-04-19 09:09:19 -07:00
Tyler Yahn
d9566abea9
Fix OTLP testing flake: signal connection from mock collector (#1816)
* Wrap TCP listener

The mock collector listener now signals when it receives a connection
instead of waiting an arbitrary time an hoping the event happens.

* Only close the listener C chan once

* Apply PR feedback

* Backwards compatible support for closed listener check

* Cleanup
2021-04-17 09:26:06 -07:00
Gustavo Silva Paiva
a2cecb6e80
add support for env var configuration to otlp/gRPC (#1811)
* move options to `otlpconfig` internal package

* add support for env configs on otel/gRPC

* remove duplicate code

* refactor options

* format imports

* move marshal option to oltphttp

* clone tls configs and tests grpc certificates

* add more context to http errors

* add todo

* add entry to changelog

* update changelog with pr number

* apply suggestions

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-16 14:52:24 -07:00
Aaron Clawson
b09df84a24
Changes stdout to expose the *sdktrace.TracerProvider (#1800)
* Changes stdout to expose the actual tracerProvider

This enables flushing and stopping the exporter.

* updated changelog

* Update CHANGELOG.md

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-14 08:51:41 -07:00
Tyler Yahn
6db20e008d
Remove the abandoned Process struct in Jaeger exporter (#1804)
* Remove the abandoned Process struct in Jaeger exporter

Use of this struct was removed in #1776.

* Update changelog
2021-04-13 10:08:04 -07:00
Szymon Łągiewka
086abf342d
docs: use test example to document prometheus.InstallNewPipeline (#1796)
* docs: update InstallNewPipeline example comment

* docs: update changelog after PR submit

* fix: wrap issue number in parens

* docs: use test example to document prometheus.InstallNewPipeline

* fix: update CHANGELOG to reflect PR state

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-13 09:03:18 -07:00
Huy Vo
99c477feb8
Fixed typo for default service name in Jaeger Exporter (#1797)
* Fix typo in jaeger exporter

* Update changelog

* Add PR number to changelog

* Move entry in changelog to Fixed

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-12 08:49:55 -07:00
sicong.huang
9b25164481
Zipkin Exporter: Use default resouce's serviceName as default serivce name (#1777) (#1786)
Signed-off-by: lastchiliarch <lastchiliarch@163.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-12 08:36:21 -07:00
Alik Khilazhev
4d141e4752
Add k8s.node.name and k8s.node.uid to semconv (#1789)
* Add k8s.node.name and k8s.node.uid to semconv

According to the specification[1] they should exist.

[1] https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/k8s.md#node

* Update changelog

* Update semconv/resource.go

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

* Update semconv/resource.go

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

* Update CHANGELOG.md

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

* Update semconv/resource.go

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-12 08:21:13 -07:00
Sai Nadendla
c5d006c07a
Update Jaeger environment variables (#1752)
* Update Jaeger Environment Variables

* Update CHANGELOG

* Add Jaeger environment vars envAgentHost, envAgentPort; remove envDisabled

* Fix broken test due to setting nonexistant env var

* fix function name

* add default values for agent hostPort

* remove agentEndpoint arg

* add agent host/port options

* update client params

* add envOr function
2021-04-09 09:56:26 -07:00
Sergei Semenchuk
584328080a
add NewExportPipeline and InstallNewPipeline for otlp (#1373)
* add NewExportPipeline and InstallNewPipeline for otlp

Signed-off-by: binjip978 <binjip978@gmail.com>

* remove resource, AlwaysSample, Timeout, etc

* remove withSpanProcessor

Signed-off-by: binjip978 <binjip978@gmail.com>

* move changelog entry to unreleased

Signed-off-by: binjip978 <binjip978@gmail.com>

* merged with combined push/pull metrics controller

Signed-off-by: binjip978 <binjip978@gmail.com>

* remove SetMeterProvider

* Update CHANGELOG.md

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

* Update CHANGELOG.md

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

* Update exporters/otlp/otlp.go

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

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-08 11:11:22 -07:00
Matej Gera
7d8e6bd781
Zipkin Exporter: Adjust span transformation to comply with the spec (#1688)
* Adjust instrumentation lib name / version key

* Adjust array attribute serialization

* Adjust span status mapping

- remove `otel.status_description`; use `error` instead for description
- do not report status code if unset
- do not report description if OK or unset
- omit tags if no tag has been mapped
- adjust tests

* Set remote endpoint according to the spec

- See
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/zipkin.md#remote-endpoint

* Fix remaining tests

* Update CHANGELOG

* Add some more tests

* Address PR feedback

- Simplify deletion of redundant error code
- Simplify endpoint rank determination

* More tests for remote endpoint
2021-04-07 13:33:15 -04:00
Tyler Yahn
2817c09174
Merge sdk/export/trace into sdk/trace (#1778)
* Merge sdk/export/trace into sdk/trace

* Update package move

* Add changes to changelog

* Add PR number to changelog
2021-04-07 08:03:43 -07:00
IrisTuntun
23422c56df
Remove process config for Jaeger exporter (#1776)
* remove process config for Jaeger exporter

* remove process config for Jaeger exporter

* Add CHANGELOG.md back

* Add CHANGLOG.md changes back

* fill in PR number in CHANGELOG

* Update CHANGELOG.md

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-06 15:03:32 -07:00
Cynthia Du
0d49b592ec
Add test to check bsp ignores OnEnd and ForceFlush post Shutdown` (#1772)
* Add test to check bsp ignores OnEnd and ForceFlush post shutdown

* Add to CHANGELOG

* Check for err return value

* Stop test execution if there's error with shutting down bsp

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

* Use assert to check there's no error calling bsp.ForceFlush()

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

* Import require

* Add error message for assertion on be.len()

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-06 14:54:26 -07:00
Tyler Yahn
e9aaa04b8f
Record links/events attribute drops independently (#1771)
* Record links/events attribute drops independently

* Update PR number

* Remove unneeded span.droppedAttributeCount
2021-04-06 07:51:15 -07:00
humivo
5bbfc22cbc
Make ExportSpans for Jaeger Exporter honor deadline (#1773)
* Make ExportSpans for Jaeger honor deadline

* Make variable name more descriptive

* new commit

* Revert "new commit"

This reverts commit 06e24cc38d.

* Change PR number in changelog

* Take out separate goroutine and add back TODO

* Check error string

* Fix error assert

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-05 13:33:16 -07:00
Matej Gera
3c7facee73
Add ExportTimeout option to batch span processor (#1755)
* Add ExportTimeout option

* Adjust tests

* Update CHANGELOG

* Beef up the exporter timeout test

* Beef up exporter test - attempt #2

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-05 10:38:03 -07:00
Anthony Mirabella
c6b92d5b20
Make TraceFlags spec-compliant (#1770)
* Make TraceFlags spec-compliant

* Remove `trace.FlagsDebug` and `trace.FlagsDeferred`
  * These are used only by the B3 propagator and will be handled there in the `context.Context`
* Make `trace.TraceFlags` a defined type, aliasing `byte`
* Move `IsSampled` method from `trace.SpanContext` to `trace.TraceFlags`
* Add `Sampled(bool)` method to `trace.TraceFlags`
* Implement `Stringer` and `json.Marshaler` for `trace.TraceFlags`

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

* Rename `TraceFlags.Sampled()` to `TraceFlags.WithSampled()` for consistency

* Restore `SpanContext.IsSampled()` method.

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-04-05 10:21:42 -07:00
Gustavo Silva Paiva
52a24774da
add support for configuring tls certs via env var to otlp/HTTP (#1769) 2021-04-02 17:53:40 -04:00
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
Jack Wink
33699d242d
Adds semantic conventions for exceptions (#1492)
Adds support for the opentelemetry exceptions semantic conventions. In
short, this has RecordError produce an exception event with exception
attributes instead of using the error event and error attributes.

While golang does not have exceptions, the spec itself does not
differentiate between errors and exceptions for recording purposes.
RecordError was kept as the method name, both for backwards
compatibility and to reduce confusion (the method signature takes in a
golang error object). The spec appears to allow this, as it suggests the
method is optional and signature may reflect whatever is most appropriate
for the language implementing it.

It may seem non-intuitive to log an exception event from a method called
RecordError, but it's beneficial to have consistent behavior across all
opentelemetry SDKs. Downstream projects like the opentelemetry-collector
can build off of the published API and not special case behaviors from
individual languages.
2021-04-01 13:07:46 -07:00
humivo
928e3c38e6
Modify ForceFlush to abort after timeout/cancellation (#1757)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-04-01 10:42:19 -07: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
bryan-aguilar
d575865b1e
Fix span IsRecording when not sampling (#1750)
* Adjust TestRecording fucntion to validate with and without sampling. correct span.isRecording logic to return false when not being sampled

* Changed to TestExectutionTracerTaskEnd to only expect 1 span to increment instead of all 3

* added changelog entry

* Updated CHANGELOG.md

* Remove newline from isRecording()

* Rewrite TestSpanIsRecording to include table based
tests and check for when span is ended immediately

* Update sdk/trace/trace_test.go

Improve readability of test name

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

* Update sdk/trace/trace_test.go

Improve readability of test name

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

* Update CHANGELOG.md

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

* Update sdk/trace_test.go test comments

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

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-30 13:26:42 -07:00
Tyler Yahn
20c93b01eb
Update SamplingParameters (#1749)
* Update SamplingParameters

Remove HasRemoteParent fields from SamplingParameters. The
HasRemoteParent field is a duplicate of the Remote field of the parent
span context contained in the ParentContext.

Change the `ParentContext` field from storing a `SpanContext` to a
`context.Context` that holds the parent span. This is to conform with
the OpenTelemetry specification and resolve #1727.

* Update PR number
2021-03-30 10:34:40 -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
Tyler Yahn
604b05cbcf
Store current Span instead of local and remote SpanContext in context.Context (#1731)
* Store Span instead of local/remote SpanContext in Context

Now that the SpanContext has a remote identifier, storing a Span's
SpanContext two separate ways in a Context (one for local another for
remote) is unnecessary and adds complication throughout the project when
determining heredity of a Span. This moves to storing the Span directly
in the Context uniformly (for both local and remote) as current Span. In
the process, it updates the getter/setter functionality the `trace`
package provides and replaces the distributed heredity logic throughout
the project with just using the current Span as the parent if it exists.

* Update trace/context.go

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

* Assert propagators context remote state

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-03-29 08:55:44 -07:00
Sam Xie
862a5a68a8
Remove setting error status while recording error with Span from oteltest package (#1729)
* Remove setting error status while recording error

* Update CHANGELOG

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-25 08:22:48 -07:00
Tyler Yahn
6defcfdf45
Remove links on NewRoot spans (#1726)
* Remove links on NewRoot spans

To ensure forwards compatibility, remove the unspecified links currently
set on `NewRoot` spans.

Resolves #461

* Remove links from oteltest tracer to match
2021-03-25 10:36:39 -04: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
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
Anthony Mirabella
9d4eb1f6d3
Update dates in CHANGELOG.md for 2021 releases (#1723) 2021-03-19 20:34:06 -04: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
Tyler Yahn
0fe65e6bd2
Comply with OpenTelemetry attributes specification (#1703)
* Add Valid method to KeyValue

* Use KeyValue.Valid in attribute add on Span

* Resource StringDetector errors for invalid attribute

* Ignore invalid attr in NewWithAttributes

The OpenTelemetry specification requires attributes conform to a
standard evaluated and returned by attribute.KeyValue.Valid. To comply
with the specification, Resources created from NewWithAttributes need to
only contain valid attributes. This adds a check to ensure this and
drops invalid attributes passed as arguments.

* Add changes to changelog

* Add nolint comment

The attribute.Set is (possibly overly) optimized to avoid allocations.
The returned value from the constructor is a value of a Set, not a
pointer to the Set. A Set contains a lock value and pointer methods so
passing the Set value raises the copylock go vet error. This copies the
same nolint comment from the `NewSet` method this used to use.

* Apply suggestions from code review

Co-authored-by: Sam Xie <xsambundy@gmail.com>

Co-authored-by: Sam Xie <xsambundy@gmail.com>
2021-03-17 20:48:43 -04: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
David Ashpole
a1539d4485
OpenCensus metric exporter bridge (#1444)
* add OpenCensus metric exporter bridge

* Update bridge/opencensus/README.md

Co-authored-by: Eric Sirianni <sirianni@users.noreply.github.com>

Co-authored-by: Eric Sirianni <sirianni@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-11 09:49:20 -08:00
Bogdan Drutu
77aa218d4d
Fix issue #1490, apply same logic as in the SDK (#1687)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-10 11:04:05 -08:00
Bogdan Drutu
9d3416cc91
Fix synchronization issues in global trace delegate implementation (#1686)
* Fix synchronization issues in global trace delegate implementation

Running tests with `-race` and before the fix
```
➜  opentelemetry-go git:(fixconcurrency) go test -race go.opentelemetry.io/otel/internal/global
==================
WARNING: DATA RACE
Write at 0x00c00010ffc8 by goroutine 28:
  go.opentelemetry.io/otel/internal/global.(*tracer).setDelegate.func1()
      /Users/lazy/github/opentelemetry-go/internal/global/trace.go:118 +0xf4
  sync.(*Once).doSlow()
      /usr/local/opt/go/libexec/src/sync/once.go:68 +0x109
  sync.(*Once).Do()
      /usr/local/opt/go/libexec/src/sync/once.go:59 +0x68
  go.opentelemetry.io/otel/internal/global.(*tracer).setDelegate()
      /Users/lazy/github/opentelemetry-go/internal/global/trace.go:118 +0x76
  go.opentelemetry.io/otel/internal/global.(*tracerProvider).setDelegate()
      /Users/lazy/github/opentelemetry-go/internal/global/trace.go:75 +0x16f
  go.opentelemetry.io/otel/internal/global.SetTracerProvider.func1()
      /Users/lazy/github/opentelemetry-go/internal/global/state.go:65 +0xd0
  sync.(*Once).doSlow()
      /usr/local/opt/go/libexec/src/sync/once.go:68 +0x109
  sync.(*Once).Do()
      /usr/local/opt/go/libexec/src/sync/once.go:59 +0x68
  go.opentelemetry.io/otel/internal/global.SetTracerProvider()
      /Users/lazy/github/opentelemetry-go/internal/global/state.go:57 +0x79
  go.opentelemetry.io/otel.SetTracerProvider()
      /Users/lazy/github/opentelemetry-go/trace.go:43 +0x388
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:177 +0x373
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202

Previous read at 0x00c00010ffc8 by goroutine 29:
  go.opentelemetry.io/otel/internal/global.(*tracer).Start()
      /Users/lazy/github/opentelemetry-go/internal/global/trace.go:124 +0x64
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func1()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:165 +0xf1

Goroutine 28 (running) created at:
  testing.(*T).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:1239 +0x5d7
  testing.runTests.func1()
      /usr/local/opt/go/libexec/src/testing/testing.go:1512 +0xa6
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202
  testing.runTests()
      /usr/local/opt/go/libexec/src/testing/testing.go:1510 +0x612
  testing.(*M).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:1418 +0x3b3
  go.opentelemetry.io/otel/internal/global_test.TestMain()
      /Users/lazy/github/opentelemetry-go/internal/global/internal_test.go:39 +0x4dc
  main.main()
      _testmain.go:85 +0x271

Goroutine 29 (running) created at:
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:160 +0x259
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202
==================
==================
WARNING: DATA RACE
Write at 0x00c00037a000 by goroutine 29:
  sync/atomic.StoreInt32()
      /usr/local/opt/go/libexec/src/runtime/race_amd64.s:242 +0xb
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func2.1()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:183 +0x6d
  go.opentelemetry.io/otel/internal/global_test.fnTracer.Start()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:81 +0x98
  go.opentelemetry.io/otel/internal/global.(*tracer).Start()
      /Users/lazy/github/opentelemetry-go/internal/global/trace.go:125 +0xfd
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines.func1()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:165 +0xf1

Previous write at 0x00c00037a000 by goroutine 28:
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:176 +0x2c4
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202

Goroutine 29 (running) created at:
  go.opentelemetry.io/otel/internal/global_test.TestTracerDelegates_MultiGoRoutines()
      /Users/lazy/github/opentelemetry-go/internal/global/trace_test.go:160 +0x259
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202

Goroutine 28 (running) created at:
  testing.(*T).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:1239 +0x5d7
  testing.runTests.func1()
      /usr/local/opt/go/libexec/src/testing/testing.go:1512 +0xa6
  testing.tRunner()
      /usr/local/opt/go/libexec/src/testing/testing.go:1194 +0x202
  testing.runTests()
      /usr/local/opt/go/libexec/src/testing/testing.go:1510 +0x612
  testing.(*M).Run()
      /usr/local/opt/go/libexec/src/testing/testing.go:1418 +0x3b3
  go.opentelemetry.io/otel/internal/global_test.TestMain()
      /Users/lazy/github/opentelemetry-go/internal/global/internal_test.go:39 +0x4dc
  main.main()
      _testmain.go:85 +0x271
==================
--- FAIL: TestTracerDelegates_MultiGoRoutines (0.20s)
    testing.go:1093: race detected during execution of test
FAIL
FAIL    go.opentelemetry.io/otel/internal/global        0.920s
FAIL
```

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update internal/global/trace_test.go

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

* Update internal/global/trace_test.go

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

* Make tests not flaky

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-10 08:45:31 -08:00
Matej Gera
58f69f091e
Span status from HTTP code: Do not set status message if it can be inferred (#1681)
* Do not set status message if reason can be inferred

* Update CHANGELOG

* Add comment on validation func

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-10 08:28:09 -08: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
Sam Xie
66b1135af4
Fix CHANGELOG (#1680)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-09 13:02:42 -08:00
ET
3684191338
Remove WithRecord() option from trace.SpanOption when starting a span (#1660)
* Remove `WithRecord()` option from SpanConfig options

This brings the trace API into conformance with the specification.

* Add entry to CHANGELOG

Fixes #192

* Updated CHANGELOG with PR#

* Cleaned up CHANGELOG notes

* fixup! Merge remote-tracking branch 'upstream/main' into remove-with-record

* Use new spanContext API to set traceflags, tracestate

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-09 09:45:09 -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
Veera Pirla
a5edd79e31
Removed setting error status while recording err as span event (#1663)
* Fix #1661 Removed setting error status while recording err as span event

* Update CHANGELOG.md

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

* Update RecordError method doc

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

* Fix grammatical errors in Changelog

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

* Update RecordError method doc

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-08 11:31:01 -08:00
Tyler Yahn
3dc91f2d76
Add ForceFlush method to TracerProvider (#1608)
* Add ForceFlush method to TracerProvider

The specification requires that a TracerProvider have a ForceFlush
method that can be set with a timeout, return any error to the caller,
and have all the registered span processors export their spans. This
updates the SpanProcessor.ForceFlush method to accept a context and
return an error and plumbs this method into a new ForceFlush method of
the SDK TracerProvider.

Additionally, this corrects the TracerProvider Shutdown method. This
method as well needs to return to the caller any failure it encounters
according to the specification. This returns an error if it cannot type
assert the spanProcessorStates or if shutting down a span processor
results in an error.

Resolves #1606

* Add changes to changelog

* Apply suggestions from code review

Co-authored-by: Steven E. Harris <seh@panix.com>

* Cancel export context when BSP stops

* Defer cancel call in BSP span processor funcs

Co-authored-by: Steven E. Harris <seh@panix.com>
2021-03-08 11:12:13 -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
Tyler Yahn
569048591c
Update the SimpleSpanProcessor (#1612)
* Update the SimpleSpanProcessor

Subsequent calls to OnStart, OnEnd, and ForceFlush should be ignored
gracefully once Shutdown has been called. This implements that behavior
by shutting down the exporter and removing it from the
SimpleSpanProcessor so subsequent calls to OnEnd will be no-ops.

* Add changes to changelog

* Lock in sync.Once of shutdown instead of Shutdown scope

* Update CHANGELOG.md

Co-authored-by: Steven E. Harris <seh@panix.com>

* Release exporterMu before shutdown exporter

* Move changes to unreleased section of changelog

* Update simple_span_processor.go

revert comment change from merge

Co-authored-by: Steven E. Harris <seh@panix.com>
2021-03-08 09:50:15 -08:00
Veera Pirla
a7f7abac65
SpanStatus description set only when status code is set to Error (#1662)
* Fix #1658 SpanStatus description set only when status code is set to error

* 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-08 09:40:38 -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
Veera Pirla
238e7c61ba
Add non-empty string check for attribute keys (#1659)
* Fixes #1657 Add non-empty string check for attribute keys

* Update PR number in changelog

* Update CHANGELOG.md

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

* Update sdk/trace/span.go

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-08 09:24:29 -08:00
ET
e9b9aca8a6
Add tests for propagation of Sampler Tracestate changes (#1655)
* Add tests for propagation of Sampler Tracestate changes

Sampler specification indicates that SamplingResult.Tracestate
should be associated with the SpanContext of the newly created span.
See
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampler

* Fix SamplingResult TraceState propagation

* Add Changelog entry

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-03-08 08:05:25 -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
Tyler Yahn
62e2a0f766
Unexport the simple and batch SpanProcessors (#1638)
* Unexport the simple and batch SpanProcessors

* Update changes in changelog
2021-03-05 08:08:29 -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
Tyler Yahn
e25503a00e
Add compatibility tests to CI (#1567)
* Add compatibility tests to CI

* Increase timeout to 60s

Some of the aggregator tests are running just over 30 seconds when
testing on Windows. Bump this to allow for it.

* Remove cache setup jobs

Having a unified job setup the cache when none exists so packages are
only downloaded once is ideal, but these steps are taking too long. In
some situations they are doubling the run time. Remove them and prefer
to have multiple downloads when dependencies change.

* Add changes to changelog

* Remove mod-download target from Makefile

Unused now that the cache jobs are removed.

* Add compatibility testing table to changelog

* Add change about precommit to changelog

* Update README

* Correct examples target in lint job
2021-03-01 08:38:23 -08: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
Tyler Yahn
e499ca86b7
Fix validation for tracestate with vendor and add tests (#1581)
* Fix validation for tracestate with vendor

* Add changes to changelog
2021-02-25 07:36:37 -08:00
Tyler Yahn
43886e52f3
Make timestamps sequential in lastvalue agg check (#1579)
* Make timestamps sequential in lastvalue agg check

* Set PR number in changelog

* Fix location of sleep

The lastvalue timestamp is set on update. Correct the location of the
sleep to bridge the update of the two different aggregators.
2021-02-25 07:20:38 -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
562eb28b71
Unify the Added sections of the unreleased changes (#1580) 2021-02-24 12:27:34 -05: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
bd4701eb93
Stagger timestamps in exact aggregator tests (#1569)
* Stagger timestamps in exact aggregator tests

Fixes #1559.

* Missed one

* Yield while you wait

* Just sleep for a teeny tiny bit

* Oops, wrong PR in Changelog

* Make sure that *some* time passes

* Keep time comparisons relaxed
2021-02-23 14:30:47 -05:00
Hussein Al Abry
b94cd4b249
add code attributes to semconv package (#1558)
* add code attributes to semconv package

* update changelog

* update comment for code semconv attributes

Adds a full-stop at the end of the comment.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-22 13:42:52 -08: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
Sam Xie
298c5a142f
Update span limits to conform with OpenTelemetry specification (#1535)
* Change the default span limit values to 128

* Rename and move MaxEventsPerSpan, MaxAttributesPerSpan, MaxLinksPerSpan into SpanLimits

* Add AttributePerEventCountLimit and AttributePerLinkCountLimit

* Update CHANGELOG

* Apply suggestions from code review

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

* Discard over limited attributes of links in `span.addLink`

* Change the type of droppedAttributeCount to int64

* Fix tests

* Fix label -> attribute package rename from merge

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2021-02-18 11:31:35 -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
Anthony Mirabella
1b5b662136
Remove resampling on span.SetName (#1545)
The spec makes it optional to attempt resampling when changing the name
of a span and we're not sure whether it can be done in an appropriate
manner, so it's best to not do it at all for now.  We can try again
later if we find a good way to do it.
2021-02-18 09:49:10 -08: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
Punya Biswal
3bce9c97f8
Add Keys() method to propagation.TextMapCarrier (#1544)
...and propagation.HeaderCarrier to adapt http.Header to this interface.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-17 08:04:49 -08:00
Punya Biswal
0b1a1c7237
Make oteltest.SpanRecorder into a concrete type (#1542)
* Make oteltest.SpanRecorder into a concrete time

* Fixes

* Fix PR #

* Re-run

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-02-17 07:31:59 -08: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
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
Tyler Yahn
6b340501b3
Update default branch name (#1505)
* Update README master branch URL to main

* Remove master branch from workflow triggers

The master branch has been renamed to main.

* Add changes to CHANGELOG

* Rename other projects default branch

All of OpenTelemetry is moving to rename `master` to `main`, this
updates all other URLs for those projects.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-02-04 11:13:25 -08:00
ET
1952d7b6af
Reverse order of attribute precedence when merging two Resources (#1501)
* Reverse order of attribute precedence when merging two Resources

This reflects a change in the specification itself.
https://github.com/open-telemetry/opentelemetry-specification/pull/1345

* Resolves #1500

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-29 12:50:55 -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
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
207587b6ab
Metric histogram aggregator: Swap in SynchronizedMove to avoid allocations (#1435)
* Move emptyState() allocations outside lock

* Add more testing

* Re-comment; add CHANGELOG

* Add CHANGELOG PR number

* Update CHANGELOG.md

Co-authored-by: Sam Xie <xsambundy@gmail.com>

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
Co-authored-by: Sam Xie <xsambundy@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2021-01-13 20:21:28 -05:00
Sam Xie
c29c6fd1ad
Shutdown underlying span exporter while shutting down BatchSpanProcessor (#1443)
* Fix BatchSpanProcessor does not shutdown underlying span exporter

* Update CHANGELOG

* Fix tests

* Update CHANGELOG.md
2021-01-13 20:14:03 -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
Anthony Mirabella
74deeddd26
Handle tracestate in TraceContext propagator (#1447)
* TraceContext propagator now handles `tracestate`.

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

* Prevent invalid tracestate from invalidating traceparent.

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

* Fail tests early if unable to construct expected TraceContext

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
2021-01-12 11:12:14 -08: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
Azfaar Qureshi
0682db1e23
Adding Security Workflows to GitHub Actions (2/2): gosec workflow (#1429)
* adding gosec gha workflow

* removing PR and commit triggers

* adding cronjob

Co-authored-by: Azfaar Qureshi <azfaarq@amazon.com>
2021-01-06 12:06:16 -08:00
Azfaar Qureshi
11f732b85c
Adding Security Workflows to GitHub Actions (1/2): codeql workflow (#1428)
* adding codeql workfklow

* removing PR and commit triggers

* updating changelog

* removing push trigger

Co-authored-by: Azfaar Qureshi <azfaarq@amazon.com>
2021-01-06 11:54:09 -08:00
Andrei Ozerov
40f1c0039d
Add Tracestate into the SamplingResult struct (#1432)
* Add Tracestate into the SamplingResult struct

Add `trace.Tracestate` field into the SDK `trace.SamplingResult` struct.

Use ParentContext from SamplingParameters to return Tracestate in
`traceIDRatioSampler`, `alwaysOnSampler` and `alwaysOffSampler`.

Add a new test to check that Tracestate is passed.

* Updated CHANGELOG.md for #1432 PR

Added changes description for #1432.

* Update sdk/trace/sampling_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2021-01-06 11:09:48 -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
Tyler Yahn
2def8c3db0
Add Versioning Documentation (#1388)
* Initial versioning documentation

* Add changes to changelog

* Remove leftover goals cruft

* Language fixes

* Add contrib policy

* Apply suggestions from code review

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>

* Add info on rc precedence in example

* Rename metrics to metric

* Add sentence about how modules become stable

* Update VERSIONING.md

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-12-29 10:34:46 -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
Azfaar Qureshi
3fb80fb2df
Fix duplicate checkout action in GitHub workflow (#1407)
* remove duplicate checkout

* adding changelog
2020-12-17 08:59:44 -08:00
Azfaar Qureshi
bdf87a7896
Migrate CircleCI ci.yml workflow to GitHub Actions (#1382)
* migrating CircleCI jobs to GitHub Actions

* using container matrix instead

* prevent entire workflow from stopping if one go version job fails

* updating github ci to use setup-go

* updating changelog
2020-12-14 19:40:15 -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
Joshua MacDonald
eb28005e2f
Metric Accumulator fix for SumObservers (#1381)
* Let SynchronizedMove(nil) reset and discard

* Add common test for SynchronizedMove(nil)

* End-to-end test for the Processor and SumObserver

* Implement SynchronizedMove(nil) six ways

* Lint

* Changelog

* Test no reset for wrong aggregator type; Fix four Aggregators

* Cleanup

* imports

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-12-10 18:13:08 -08:00
Anthony Mirabella
970755bd08
Enable support for externally-defined ID generators (#1363)
* Enable support for externally-defined ID generators

* Moved the SDK's `internal.IDGenerator` interface to the `sdk/trace`
package.
* Added `trace.WithIDGenerator()` `TracerProviderOption`.

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

* Update CHANGELOG.md with PR info

* Address PR feedback:

* Fix IDGenerator godoc comment
* rename type defaultIDGenerator to randomIDGenerator
* rename defIDGenerator() to defaultIDGenerator()

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

* Rework trace.IDGenerator interface

* NewTraceID() -> NewIDs(ctx)
** Returns both TraceID and SpanID
* NewSpanID() -> NewSpanID(ctx, traceID)
** Returns only SpanID, has access to TraceID
* Both methods now receive a context, from which they may extract
information
* startSpanInternal() updated to receive a context to pass to the ID
generator

* Drop outdated comment from docblock

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>

Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com>
2020-12-09 20:30:32 -05: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
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
e0819780f9
Move opencensus example to the example directory (#1359)
And update .gitignore, so the built binary does not show up in git
status.
2020-11-20 13:34:40 -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
David Ashpole
34aa6816c1
revert part of #1334. Move binary propagation to contrib (#1353)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
2020-11-19 18:09:39 -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
Daniil Rutskiy
2c2f9852fe
Add missing tests for attributesMap (#1337)
* Rename sdk/trace/attributesMap.go -> sdk/trace/attributesmap.go

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

* Add missing tests for attributesMap

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

* Update CHANGELOG.md

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

* Add missing license header

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

* Delete underscores in test names

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

* Tests clean up

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>
2020-11-18 19:15:26 -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
Chris Bandy
c857a3da18
Pass options to configured TracerProvider (#1329)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-17 10:02:21 -08:00
David Ashpole
bbc9465ddb
Add opencensus binary propagation to bridge (#1334)
* add opencensus binary propagation bridge

* Update bridge/opencensus/binary/binary.go

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

* Update bridge/opencensus/doc.go

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

* address comments

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 10:35:25 -08:00
Sean Schade
73a05393a0
chore(semconv): Add PR number to changelog (#1323)
feat(semconv): Add DeploymentEnvironmentKey to semconv package
2020-11-16 10:29:28 -08:00
Ross Light
380d9455fd
s/HTTPUrlKey/HTTPURLKey/ in semconv (#1338)
* s/HTTPUrlKey/HTTPURLKey/ in semconv

* Fix build

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-16 09:55:25 -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
Johannes Liebermann
070b657c21
Add parent context to SpanProcessor.OnStart (#1333)
* Add parent context to SpanProcessor.OnStart

The spec requires doing so. Right now SpanProcessor implementations
aren't doing anything with this argument.

* Update changelog

* Fix typo in test name
2020-11-16 11:45:49 -05: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
David Ashpole
f6df5df938
add opencensus tracing bridge (#1305) 2020-11-12 10:51:52 -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
alrex
3a06b393b9
Update span collection limits to 1000 (#1318)
* set collection limit to 1000

* update changelog

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-10 07:40:01 -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
Tyler Yahn
757030dc78
Update Span End method documentation (#1310)
* Update Span End method documentation

Updates to the Span after End is called result it potentially
inconsistent views of the Span between the code defining it and the
ultimate receiver of the Span data. This corrects the documented
language of the API to prevent this from happening.

* Add changes to changelog
2020-11-09 10:57:34 -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
Matej Gera
9ac3a08eef
Remove MockSpan and MockTracer (#1306)
* Remove MockSpan and MockTracer

* Update CHANGELOG

Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2020-11-05 08:13:19 -08:00
Daniil Rutskiy
911d7be43d
Check marshalled value instead of iface (#1299)
* Check marshalled value

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

* Update CHANGELOG.md

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

* Move change to Fixed section

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

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-11-02 08:27:41 -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
Daniil Rutskiy
d98ad1042c
Fix Code.UnmarshalJSON to work with valid json only (#1276)
* Remove quotes from UnmarshalJSON

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

* Update CHANGELOG.md

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

* Fix issue number in CHANGELOG.md

* Fix 'Code.UnmarshalJSON' to work with valid json only

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

* Extend test data for TestCodeUnmarshalJSONErrorInvalidData

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

* Delete useless cond, extend test data

Signed-off-by: Daniil Rutskiy <dstdfx@gmail.com>
2020-10-27 15:30:49 -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
Sam Xie
230bdd10f0
Add SpanContextFromContext() (#1255)
* SpanFromContext returns nil if span not exists

* Add tests for SpanContextFromContext

* Update CHANGELOG

* Update trace.go

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

* SpanFromContext() continue to return a noopSpan{}

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-21 17:30:28 -04:00
alrex
c9bc90b3e4
Renaming otcorrelations header to baggage (#1267)
* Renaming otcorrelations header to baggage

* Update CHANGELOG.md

* cleanup comment
2020-10-20 10:51:17 -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
ec300b28ad
Update Span API event methods (#1254)
* Update Span API event methods

Remove the context argument from the event methods. It is unused and can
be added back in as a passed option if needed in the future.

Update AddEvent to accept a required name and a set of options. These
options are the new EventOption type that can be used to configure a
SpanConfig Timestamp and Attributes.

Remove the AddEventWithTimestamp method as it is redundant to calling
AddEvent with a WithTimestamp option.

Update RecordError to also accept the EventOptions.

* Add changes to CHANGELOG

* Add LifeCycleOption

Use the LifeCycleOption to encapsulate the options passed to a span for
life cycle events.
2020-10-16 08:09:27 -07:00
Tyler Yahn
786a78ea36
Add delegating global propagator (#1258)
* Add delegating global propagator

* Add Changes to CHANGELOG

* Add PR number to CHANGELOG

* Add tests using new test framework

* Revert "Add tests using new test framework"

This reverts commit af7ae17436.
2020-10-15 10:35:47 -07:00
Tyler Yahn
8fd4b26655
Add oteltest TextMap propagator and carrier (#1259)
* Add oteltest text map propagator and carrier

* Add changes to CHANGELOG

* Add PR number to CHANGELOG

* Add test for empty newState

Gotta farm that codecov
2020-10-15 09:15:52 -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
65044a118b
Move api/apitest into the otel/oteltest package (#1241)
* Move the apitest package into oteltest

* Add documentation to exported func and type

* Add changes to CHANGELOG

* Update move in other modules
2020-10-12 08:47:41 -07:00
Tyler Yahn
a46f88ee8d
Fix lint issues in otel package (#1243)
* Fix lint issues in otel package

Add documentation for the shadowed `Meter` for the time being.

Do not export `ErrInvalidHexID`, `ErrInvalidTraceIDLength`,
`ErrInvalidSpanIDLength`, `ErrInvalidSpanIDLength`, or `ErrNilSpanID`.
These are not used externally and we should reduce the API prior to a GA
release to allow flexibility going forward.

Add and update comments for all SpanKind conforming to golint spec.

* Update CHANGELOG
2020-10-12 08:43:26 -07:00
Tyler Yahn
bafde86b29
Fix lint issues in the label package (#1244)
Rename MergeItererator to MergeIterator to correct the spelling mistake.

Add comment for exported `EmptySet`.

Fix comments on the exported label `Type`s to conform to Go standards.
2020-10-12 08:39:12 -07:00
Paul Osman
02cd123542
Call sampler on local child spans. (#1233)
* Call sampler on local child spans.

* Update CHANGELOG.md

* Adding a test for calling the sampler on local child spans

* Add clarifying comment to test
2020-10-09 18:48:34 -04: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
Tyler Yahn
5660b0b59f
Update label.ArrayValue to store copies of 1D arrays (#1226)
* Update label.ArrayValue to store copies of 1D arrays

* Update OTLP transform of array attributes

* Add changes to CHANGELOG

* Add PR number to changes

* Update value function documentation

* Remove redundant checks

* Add Array test for invalid array types

* Add test to ensure return from AsArray is a type

* Clean up iteration
2020-10-05 17:09:03 -07:00
Tyler Yahn
577b21745b
Update codes to match specification (#1214)
* Update codes to match specification

* Add changes to changelog

* go mod tidy

* Add unit tests for codes

* Update SetStatus methods to only filter Unset

* Update apitest code being tested
2020-10-05 11:36:03 -07:00
Tyler Yahn
5e66340594
Add Baggage API and move Baggage propagator (#1217)
* Move api/baggage to the propagators package

* Create Baggage API to match specification

* Update CHANGELOG.md

* Baggage API unit tests

* Rename and add unit test

* Update unit test value checking

* Update TODO with issue tracking work.
2020-10-05 11:25:09 -04:00
Stanley Nguyen
de50711fcc
feat(span): remove SetAttribute method (#1216)
* feat(span): remove SetAttribute method

* Update CHANGELOG.md

Revert markdown lint changes and unify the `Removed` section.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-02 14:41:15 -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
dc79f7fe25
Remove duplicate hostname in Resource (#1219)
* Remove duplicate hostname in Resource

- Refer to opentelemetry-specification

Signed-off-by: Hui Kang <kangh@us.ibm.com>

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-10-01 08:28:27 -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