* Add internaltest templates
* Generate internaltest using gotmpl
* Generate the sdk/internal/internaltest pkg
* Use sdk/internal/internaltest in sdk module
* Generate exporters/jaeger/internal/internaltest pkg
* Use exporters/jaeger/internal/internaltest in jaeger exporter
* Generate the exporters/zipkin/internal/internaltest pkg
* Use local internaltest in zipkin exporter
* Fix import path name in trace test
* Fix ASAN bug with emptyAttributes.
If mutliple instantiations of a Resources struct are happening
in parallel, they can end up modifying the same underlying resource.
* Capture literal
* add test
* remove unwanted change
* Update sdk/resource/resource_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update sdk/resource/resource_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update sdk/resource/resource_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update sdk/resource/resource_test.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Add changelog.
* 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>
* Upgrade all use of semconv to v1.21.0
* Add change to changelog
* Add AIX and ZOS OS support
* Upgrade semconv for merged changes
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Add Version func to otel/sdk
* Update sdk/resource to use sdk version
* Remove unused UserAgent from sdk/internal
* Add changes to changelog
* Update CHANGELOG.md
Co-authored-by: Robert Pająk <pellared@hotmail.com>
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* add platform specific hostIDReaders
* add WithHostID option to Resource
* add changelog entry
* Apply suggestions from code review
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* linting
* combine platform specific readers and tests
This allows us to run tests for the BSD, Darwin, and Linux readers
on all platforms.
* add todo to use assert.AnError after resource.Detect error handling is updated
* move HostID test utilities to host_id_test
* return assert.AnError from mockHostIDProviderWithError
* use assert.ErrorIs
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com>
* Update Detect and New to wrap errors
* Add TestNewWrapedError
Test that New returns an error that can be unwrapped.
* Add changes to changelog
* Clarify and simplify errors
* WithContainerID: Document ECS limitation.
WithContainerID is not able to extract the correct container id in an ECS environment. The ECS resource detector should be used instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs).
See #3633.
* fix lint
* Update sdk/resource/config.go
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Decode values from OTEL_RESOURCE_ATTRIBUTES
The W3C spec specifies that values must be percent-encoded so when
reading the environment variable `OTEL_RESOURCE_ATTRIBUTES` the SDK
should decode them.
This is done by the `baggage` package, but its behaviour in case of
errors is slightly different from the current implementation of the SDK,
more specifically in cases where a key is missing a value. The SDK
returns a partial resource while the `bagage` package returns nil.
This may be considered a breaking change, so this commit fixes the
current implementation instead of using `baggage.Parse`.
* Add changelog entry for #2963
* Use otel.Handle on OTEL_RESOURCE_ATTRIBUTES decode error
* retain original value when decoding fails
* docs: update CHANGELOG
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Use unix.ByteSliceToString to convert Utsname []byte fields to strings.
This also allows to drop the charsToString helper which serves the same
purpose and matches ByteSliceToString's implementation.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Comment should be complete sentences outside of lists with sentence
fragments. This adds the godot linter to check these complete sentences
end with punctuation. If they do not, running fix will append a period.
* Replace use of old term label with attribute
The specification has unified on the term attribute to describe
key-value pairs. There exist still many hold-overs of the use of the
term label. This updates those uses or deprecates exported types and
functions in favor of renamed forms.
* fix infinite recursion
* Remove backticks from attribute set docs
* Remove LabelFilterSelector entirely
* Remove Metadata.Labels instead of deprecate
* Update changelog with public changes
* Revert OC err msg
* No wrap RELEASING Semantic Convention Generation section
* Initial generator
* Update template render
* Add exception and schema templates
* Add semconv/internal http unification
* Add http template
* Add licenses header
* Embed the templates
* Update static version in schema tmpl
* Add semconv-generate target to Makefile
Use this target to generate versions of the semconv packages.
* Generate semconv packages
* Update RELEASING to use make semconv-generate
* Add comments to semconvkit
* Generate semconv/v1.8.0
* Use new version of semconv
* Add changes to changelog
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
The WithProcess and WithProcessCommandArgs options contain command line
arguments as resource attributes. These could potentially expose user
secrets. Document this fact so users better understand the implications
of using these options.
* Add container id support to Resource
* Fix wrong test case name
* Add WithContainer option
* Update CHANGELOG
* Fix comments
* Update CHANGELOG
* Use regex to find container id
* Add tests for reading cgroup file
* Update sdk/resource/container.go
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* Update format
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* Change trace options to accept type not pointer
Add benchmark to show allocation improvement.
* Update CONTRIBUTING.md guidelines
* Update all Option iface
* Fix grammar in CONTRIBUTING
* 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>
* 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
* 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>
* 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
* 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>
* 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>
* 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>