* implement events v1.32
implement the events api + sdk per spec v1.32:
- event logger is now only retrievable via an event logger provider
- domain attribute for events is removed
- events accept a subset of logrecord params, rather than an entire logrecord
* convert severity to a backed enum
* lint
* remove instead of deprecating logEvent, mark Logger constructor as internal
* make severity an enum only
* event attributes to iterable
* inject ClockInterface, add CachedInstrumentation, update examples
* set correct defaults for events
* test coverage
* Revert "make severity an enum only"
This reverts commit 710822907b.
Also, move PSR-3 mapping into the Severity enum.
* event attributes to iterable
* apply review feedback
* move test tools into vendor-bin
To reduce (hopefully, eliminate) the situations where our testing tools have conflicting
dependencies, use bamarni/composer-bin-plugin to manage them as separate vendored dirs.
Add symlinks under tools/, and update Makefile to use the self-contained versions.
Remove the dependencies from root composer.json
Rejigger dockerfile to add opcache, and some config required for latest version of grpc
* update action tools locations
* revert phpstan from vendor-bin
the phpstan plugins do not work. phpstan has no dependencies anyway, so it's safe enough to keep in vendor
* remove tools symlinks, update makefile
* migrate Clock classes to API
- move Clock* + Util into API
- add a deprecated wrapper for ClockFactory and Util
- remove unused StopWatch* classes
* review feedback
* replace ClockFactory with Clock
It's not really a factory, and really only provides access to a system clock. Create a
Clock class which is more clear in its purpose.
* remove time Util class
per review feedback, it's only used in Zipkin. Removed some unused consts from ClockInterface
* Apply suggestions from code review
Co-authored-by: Tobias Bachert <git@b-privat.de>
---------
Co-authored-by: Tobias Bachert <git@b-privat.de>
our previous method of uploading to codecov.io is suffering from throttling and taking 5+ hours,
a post in the opentelemetry maintainers channel suggests this is the way to do it now
* enable timeout for http transports
Attempt to do our own discovery for some well-known PSR-18 clients, which allows
for configuring timeout (and in future certificates, keys etc).
This is not complete and a prototype for feedback, but I've updated an example to
show that it works for Guzzle and Symfony http clients
* improve client discovery
* refactor, test, add more implementations
* add timeout for logs and metrics
A couple of warnings have popped up recently:
- docker compose 'version' is deprecated
- BSD host id test was running a command that doesn't exist, which was visible in test output (removed test case)
- synchronous metric stream test was triggering a warnings which was visible in test output (changed to use LogsMessagesTrait)
- resource merging with different schema URLs was triggering a warnings from Config test (updated yaml schema_url and documented)
* port Nevay/otel-sdk-configuration into opentelemetry-php
This is a lift-and-shift, except for:
- changing namespaces
- fixes or ignore rules required to make static analysis tools happy
- commenting out one part of yaml test (unquoted hex value from env var)
* fix psalm on php81
* Improve fiber bound context storage
Now works properly in fibers once initial context is attached.
* Change `Context::storage()` return type to `ContextStorageInterface`
`ExecutionContextAwareInterface` should not be relevant for end-users / it was mainly exposed for the FFI fiber handler; calling any of its method with enabled fiber handler would have broken the storage.
Swoole context storage README creates a new storage instead of wrapping `Context::storage()`: `Context::setStorage(new SwooleContextStorage(new ContextStorage()));`.
* Add BC layer for execution context aware fiber storage
* Fix BC layer inactive execution context detection for {main}
* Port tracestate tests
* Fix tracestate implementation
* Fix W3C test service
* Fix style
* Move tests into `TraceStateTest`
* Assert that warning is triggered when parsing invalid tracestate
* Add additional tests for valid/invalid keys/values
* bump php to 8.1, apply rector
* readonly and typehints
* suppress a dodgy readonly property conversion
* remove some redundant readonly phpdocs
* dont run workflows against 8.0
* more readonly and typehints
* phpdoc reformat
* typehints
* remove php81 polyfill
* revert a rector BC breaking change, and disable that rector for ParentBased
String values which are not valid Unicode sequences SHOULD be converted to AnyValue's bytes_value with the bytes representing the string in the original order and format of the source string.
* drop php 7.4 support
update composer.json minimums, and run rector over the code to update what it can. changed some static analysis
config to fix some rector-induced failures.
* adding union typehints
* reformat constructor property promotions
* updating/removing phpdoc
* suppress protobuf extension complaint
submitted a PR upstream to fix phan stubs
* don't validate packages against 7.4
* remove php8 polyfill
* fix readonly comments
* apply trailing commas to multiline fixer
upgrade php-cs-fixer, and apply a new rule for multiline comments
* remove unreachable default match arms for protobuf serializer
* adding more union types to vars
* use weakmap directly
* remove handling for not-supported WeakMap
* spacing
* fix: Allow OTEL_PHP_DEBUG_SCOPES_DISABLED env var + use of null-coalescing operator
* refactor: Check order & env reset
* refactor: Use class constant
* fix: Respect order and value if it is set
* style: Lint
* tests: Falsey behavior
Modeled on python's feature to turn off all instrumentation for specific URLs,
https://opentelemetry.io/docs/languages/python/automatic/agent-config/#excluded-urls
this feature will effectively disable SDK autoloading if there is a request URI that
matches one of the provided excluded URLs, and no-op implementations will be used
for tracer/logger/meter providers.
* generate semconv 1.24.0
generate latest semconv version, and add back Trace and Resource attribute values which
seem to have been dropped in a previous change.
* document source repo release urls
* remove redundant semconv deprecations
two trace attributes were deleted then added back to upstream semconv, so remove our ones.
Optimize build times by caching php extensions for one week, particularly for 8.4/nightly which otherwise builds extensions from source each time.
This ended up being a little convoluted, since caching extensions does not run on failure. So, make all steps continue-on-failure for experimental builds, and add a final post job which checks the status of the steps and does a final fail.
- do not revalidate/normalize resource attributes on merge, since they have already been validated/normalized
- string concat is about 10x faster than sprintf, so use it in ClassConstantAccessor since it's called many times
* reduce resource creation from sdk autoloader
- instead of creating new resources from various factories, create them once from sdk autoloader and
pass them to the factories (most of which already supported this).
- check env before php.ini for config, since this is the more popular approach and saves some cycles
- cache header from OtlpUtil, to save a couple of calls to Sdk detector
* adding benchmark for resource creation
* Handle DebugScope out-of-order destruction during final shutdown
* Move debug traces from local scope storage to debug scope properties
* Fix phpstan error
* Add support for multi-instrument callbacks
https://opentelemetry.io/docs/specs/otel/metrics/api/#multiple-instrument-callbacks
* Fix undefined offset on detach of batch callback with repeated instrument
* Unify BatchObservableCallback and ObservableCallback
* Add missing typehint
* Do not bump API dependency
Not required, SDK will continue to work with lower API versions, only `::batchObserve()` won't be usable.
Only fails if a node that was created after exceeding 63 readers should be merged with a node that was created before exceeding 63 readers, resulting in an `GMP===int` comparison. Affected nodes were still merged on the next `::collect()` call -> solely internal change.
* Prevent propagator extensions from failing if sdk not installed
* Remove KnownValues dependency
Also prevents failing for cloudtrace: sdk < 1.0.1 and jaeger: sdk < 1.0.3.