* Use gRPC ClientConn for otlpmetricgrpc conn handling
* Update PR number
* Update otlpmetrichttp to use retry package
* Remove old commented code
* Add all other external changes to changelog
* POC using the grpc.ClientConn to handle connections
* Update invalid client security test
* Update client start test for a bad endpoint
* Use any ClientConn a user provides
* Connect ReconnectionPeriod to gRPC conn retries
* Replace connection retry handling direct in otlptracegrpc
* Fix client comments
* Fix comment for NewGRPCConfig
* Replace reconnection test
* Fix grammar
* Remove unrelated changes
* Remove connection pkg
* Rename evaluate to retryable
* POC using the grpc.ClientConn to handle connections
* Replace connection retry handling direct in otlptracegrpc
* Add ClientConn use changes to changelog
* Update otlptracegrpc options
* Only close ClientConn that the Client create
* Remove listener wrapper from mock_collector_test
This is not needed now that no tests relies on the listener to wait for
a connection to be established before continuing.
* Fix spelling error
* Do not use deprecated options in the otel-collector example
* Add unit tests for retryable and throttleDelay funcs
* Add unit tests for context heredity
* Add test that exporter stop is linked to context cancel
* go mod tidy
* Update exporters/otlp/otlptrace/otlptracegrpc/client.go
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Fix go.mod from rebase
* Remove wrong comment about client stop closing gRPC conn
* Fix shutdown test cleanup
Do not check the second call to the client Stop. There is no guarantee
it will not error in normal operation.
* Make lint fixes
* Fix flaky unit test
Use the internals of the client to explicit cancel the context returned
from exportContext. This gets around the bug where the select in Stop
may randomly choose the non-context Done case and avoid returning an
error (also failing to cancel the context).
* Remove deprecation
To configure the client/exporter with environment variables these
options are used. There is no way to fully remove these options without
removing support for configuration with environment variables. Leave
that decision and strategy determination to a separate PR.
* Fix grammatical error in comment
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* change resource.Default to be evaluated on first call, rather than on import
* guard defaultResource creation with sync.Once, fallback to emtpyResource
* update CHANGELOG
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Empty queued spans when ForceFlush called
Update the implementation of ForceFlush() to first ensure that all spans
which are queued are added to the batch before calling export spans.
Create a small ReadOnlySpan implementation which can be used as a marker
that ForceFlush has been invoked and used to notify when all spans are
ready to be exported.
Fixes#2080.
* Add a changelog entry.
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update sdk/trace/batch_span_processor.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Improve test case to verify multiple flushes.
* Refactor code to use enqueue.
* Be more defensive on waiting for queue.
Update the handling of the force flush span so we only wait on the
channel if we were able to enqueue the span to the queue.
* Fix linter.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Version stable-v1 modset to be 1.0.2 for release
* Prepare stable-v1 for version v1.0.2
* Update changelog
Add new 1.0.2 section and move relevant items that the release will
contain to this section.
* Add article to CHANGELOG entry to correct grammar
* Release 1.1.0 instead of 1.0.2
* Prepare stable-v1 for version v1.1.0
* Apply suggestions from code review
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Generated from a modified version of the v1.5.0 release of the
specification using a modified version of the semconvgen tools. The
specification contained capitalized IDs that caused errors from the
semconvgen tool. These errors were manually resolved and the rest of the
Go formatting tools were used to provide consistent code.
Important to note, the Go semconvgen tooling includes new name
capitalization rules for ReplicaSet, StatefulSet, and DaemonSet that
mean code names are not backwards compatible. This is included in the
changelog to help users perform the upgrade.
Generated from the v1.6.1 release of the specification using the
semconvgen tool manually.
This skips the v1.6.0 release of the specification, with no plans to add
support in the future, due to a backwards in compatibility bug in
included.
* Add semconv/v1.7.0 package
Generated from the v1.7.0 release of the specification using the
semconvgen tool manually. This also updates the project to use this
version of the semconv package.
This does not include the prior, and missing, v1.5.0 and v1.6.0 versions
of the semconv package. They are planned to be added in a follow-on PR.
* Update CHANGELOG.md
* Fix IPv6 handling errors in semconv.NetAttributesFromHTTPRequest
fixes#2283
* Enter PR number in CHANGELOG
* Remove unnecessary creation and then assignment
Standardize order of checks for IP, Name, Port
* Assume happy path when parsing host and port
i.e. assume net.SplitHostPort(input) will succeed
* Get rid of uint64 for port
* Fix git merge of main by adding back strings import
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
* Fix: http.client_ip vs multiple addresses #2282
* Split only the necessary number of values.
As suggested by @pellared. Good suggestion, that.
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>
* Add ability to parse Schema files according to OTEP 0152
The parser and parsed representation (AST) are placed in a separate
Go module so that they are can be consumed independently without
the need to bring the rest of the SDK.
Ability to use the parsed representation for schema conversions
can be added later.
* Fixes based on PR comments
* Rename "label" to "attributes"
See https://github.com/open-telemetry/oteps/pull/181
* Fixes based on PR comments
* Add README.md
* Wrap the error in Parse()
* Add docs for exporter types
* Use yaml.NewDecoder
* Verify parsed content in the test
* Fix indentation in README example
* Fix README spaces vs tabs
* Correctly space imports
* Add heading to README
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* move Descriptor to sdkapi, add test
* rename Descriptor to sdkapi
* precommit
* Move the rest of the sdkapi
* use alias for Observation and Measurement
* Changelog
* pr num
* comment Measurement and Observation
* swap comments
* move->moved
* Update build tools
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update CHANGELOG and versions.yaml
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Prepare stable-v1 for version v1.0.1
* Prepare experimental-metrics for version v0.24.0
* Prepare bridge for version v0.24.0
* Update releasing documentation and create add-tags make target
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* use multimod from the .tools directory
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* precommit
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* factor instrumentation library out of the instrument descriptor
* SDK tests pass
* checkpoint work
* otlp and opencensus tests passing
* prometheus
* tests pass, working on lint
* lint applied: MetricReader->Reader
* comments
* Changelog
* Apply suggestions from code review
Co-authored-by: alrex <alrex.boten@gmail.com>
* remove an interdependency
* fix build
* re-indent one
* Apply suggestions from code review
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Lint&feedback
* update after rename
* comment fix
* style fix for meter options
* remove libraryReader, let Controller implement the reader API directly
* rename 'impl' field to 'provider'
* remove a type assertion
* move metric/registry into internal; move registry.MeterProvider into metric controller
* add test for controller registry function
* CheckpointSet->Reader everywhere
* lint
* remove two unnecessary accessor methods; Controller implements MeterProvider and InstrumentationLibraryReader directly, no need to get these
* use a sync.Map
* ensure the initOnce is always called; handle multiple errors
* Apply suggestions from code review
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* cleanup locking in metrictest
* Revert "ensure the initOnce is always called; handle multiple errors"
This reverts commit 3356eb5ed0.
* Revert "use a sync.Map"
This reverts commit ea7bc599bd.
* restore the TODO about sync.Map
Co-authored-by: alrex <alrex.boten@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Update versions file for 1.0.0 release
* Prepare stable-v1 for version v1.0.0
* Update trace signal status in documentation
* Update changelog
* Update CHANGELOG.md
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
This method did not have any effect. had been used back
when exporters were providing utility methods for setting up full
pipelines. These utilities went away in
4883cb119d.
We previously were recording the Schema URL but were not setting
the recorded value when exporting. This change now uses the recorded
value when exporting to OTLP.
* Fix slice-valued attributes when used as map keys
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* store pointers to slice values to make them usable as map keys
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Emit slice-typed attribute values as slices, not pointers to slices
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Update release versions
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Prepare experimental-metrics for version v0.23.0
* Prepare bridge for version v0.23.0
* Prepare stable-v1 for version v1.0.0-RC3
* Update CHANGELOG
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Update the website getting started docs
Add a new example, fib, that contains an application for the computation
of Fibonacci numbers. Use this example to update the website getting
started documentation.
* Revise docs english
* Update example/fib/go.mod
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Add a What's Next section
* Clean up intro
* Apply suggestions from code review
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Apply feedback
* Return from Poll on error
* Update website_docs/getting-started.md
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* Add root and parent relationship info
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
* s/ValueRecorder/Histogram/g
* s/ValueObserver/GaugeObserver/g
* s/UpDownSumObserver/UpDownCounterObserver/g
* s/SumObserver/CounterObserver/g
* changelog
* pr num
* unstable->experimental
* Apply suggestions from code review
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Apply suggestions from code review
* apply feedback from @evantorrie by hand
* Apply suggestions from code review
Thanks
Co-authored-by: ET <evantorrie@users.noreply.github.com>
* Update sdk/export/metric/metric.go
* Apply suggestions from code review
Thank you @evantorrie !
Co-authored-by: ET <evantorrie@users.noreply.github.com>
* revert getting-started fix let tyler's update remove this text
* more variable name fixes
* test repair
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: ET <evantorrie@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Update trace API config creation funcs
Follow our style guide and return the config struct instead of pointers.
* Update changelog with changes
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* 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
* 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>
* 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
* 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>
* 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>
* 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
* 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
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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>
* 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
* 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>
* 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>
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>
* 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
* 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>
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.
* 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.
* 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>
* 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>
* 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
* 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
* 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.
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>
* 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>
* 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>
* drop failed to exporter batches and return error when forcing flush a span processor
* changelog
* changelog
* change should export condition
* cleanup
* Honor context Done in SSP Shutdown
* Update PR number in changelog
* Update comment
* Add tests
* Make tests more concise
* Restructure tests for readability
* 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>
* 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>
* 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
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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
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.
* 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>
* 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>
* 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
* 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
* 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>
* 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
This patch removes `ApplyConfig` method and `Config` struct from
`go.opentelemetry.io/otel/sdk/trace` package. To ensure valid config
for TracerProvider, it adds `ensureValidTracerProviderConfig` private
function.
Jaeger and Zipkin have been used the `Config` directly across package
boundaries. Since `Config` is removed, they can't use it. This change,
thus, replaces `WithSDK` with `WithSDKOptions`.
Resolves#1636, #1705.
* Rename WithDefaultSampler TracerProvider option to WithSampler
The term "DefaultSampler" comes from early ideas of this project where
there would be overriding samplers lower in the trace SDK. This
overriding does not exist and if it is going to be introduced in the
future the sampler associated with the TracerProvider is already scoped
based on that association (no need to scope with a name). This renames
the TracerProvider option to not include this anachronism.
* Update PR number in CHANGELOG
* Propagate rename
* Update defaults documentation for TracerProvider
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* Update sdk/trace/provider.go
Co-authored-by: Steven E. Harris <seh@panix.com>
* 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>
* 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>
* 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>
* 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
* 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>
* 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>
* 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
* 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>
* 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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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