Commit Graph

11 Commits

Author SHA1 Message Date
Brett McBride 4f32817065
Add infection test tool (#1306)
* run unit tests in random order
running in random order highlights some interference between tests (mostly logging being enabled), and is a requirement for
mutation testing (ie, all tests must pass when executed in a random order).
* adding infection mutation testing
this adds the ability to run infection. It generates a lot of output, which is an exercise for another PR...
* infection max threads
2024-05-15 20:46:42 +10:00
Brett McBride 500f6ee1bd
implement events v1.32 (#1291)
* 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
2024-05-05 18:35:19 -04:00
Brett McBride e522d9d81f
improve excluded urls code (#1227)
improve code and add more tests to the OTEL_PHP_EXCLUDED_URLS feature
2024-02-02 14:42:40 +11:00
Brett McBride 36e2b7f613
adding OTEL_PHP_EXCLUDED_URLS (#1226)
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.
2024-02-01 08:21:30 -05:00
Brett McBride 8809c2a0b5
remove global configuration resolver (#1118)
Exposing it through Globals can cause a race condition. If something (eg, a contrib module)
retrieves the configuration resolver from Globals too early during autoloading, then it
causes the rest of the objects from Globals to be initialized. This can happen before all
required modules have been registered (depending on autoload->files execution order, which
is variable). Instead, create a simple API config resolver which does the basics of what the
SDK one does (without all the type checking and validation).
2023-09-28 09:15:51 +10:00
Brett McBride 7b8daff5ef
adding configuration resolver (#1083)
adding a configuration resolver interface, and api+sdk implementations. the resolver is globally configured.
this allows contrib modules to fetch config if an SDK is installed, without directly using the SDK (per spec).
2023-07-31 13:43:09 +10:00
Brett McBride 1aea1f23b9
moving api/common classes up to api (#1033)
- apply TC review feedback to move Globals to top-level.
it was suggested to move Instrumentation into its own package, but I chose instead to just move that dir
up to the top level of API
- added a BC layer to alias the moved classes
- added some more examples
2023-06-16 08:51:03 +10:00
Brett McBride 615917f5d4
adding logs signal (#934)
* initial work on logs signal

* supressing psalm error

* "fixing" 7.4 segfault
through trial and error, I found that it was consistently segfaulting in the sdk autoloader
tests, but by running them in a different order, the failures went away.

* adding logs tests

* rename example per feedback

* move log context injection into processors, per spec

* correctly set context on logs

* update logger name per feedback

* adding variables, map psr3 to otel severity, fix timestamp

* psr-3 loggers

* tests, psr3 v3 fix

* remove LogRecordDate and refactor SDK log record classes

* tests, tidy, improvements

* remove todos

* documentation

* check for valid span context

* removing psr-3 compatibility, per spec and feedback

* use InstrumentationScopeFactoryInterface

* apply attribute limits on readablelogrecord creation
per feedback, this should be more memory efficient for the processors

* group log record by resource/scope

* remove psr3 references from readme

* ignoring psalm error

* add trace context in Logger rather than processors
per feedback, and following the example in java and python SIGs, we
can add trace context to logs once, in the logger, rather than having
processors do it. The Context passed to processors is no longer used,
but retained for spec compliance.
2023-03-22 08:11:51 -04:00
Brett McBride 7b5ca0ce97
allow OTEL_SDK_DISABLED to disable sdk autoloading (#902)
* allow OTEL_SDK_DISABLED to disable sdk autoloading
* review feedback
- test for sdk disabled in initializer
- sdk disabled does not disable propagator, per spec
2023-01-11 10:05:28 +11:00
Brett McBride 558e7ce30e
default logging to console (#899)
Rather than log nothing by default, log warnings and greater to console.
By providing a psr-3 logger, users can gain greater control over logging, including disabling it (via NullLogger)
2022-12-22 09:39:27 +11:00
Brett McBride 116e46d964
sdk autoloading (#854)
* sdk autoloading
* use instrumentation initializers
* basic sdk + autoloading documentation
* exampler filter from config
* configuration default types
2022-11-14 08:52:35 +11:00