Commit Graph

18 Commits

Author SHA1 Message Date
Brett McBride 382331e062
semconv 1.27.0 (#1356)
* generate semconv 1.27.0

* improve attribute values brief and deprecation display

* remove duplicate trace attribute, ignore deprecated attributes

* fix tests
2024-08-06 11:17:39 -04:00
Brett McBride b6f9afb5af
log discarded span+log attributes (#1336)
The SDK should log a warning once if there are any dropped span attributes, links, link attributes, events or event attributes.
The SDK should log a warning once if there are any dropped LogRecord attributes.
2024-06-27 08:52:30 +10:00
Brett McBride fbdb103590
upgrade to phpunit 11 (#1308)
* 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...
* replace assertwell/phpunit-global-state
the package was not compatible with phpunit 11. create out own test Trait, which handles
env vars, as well as general cleanup of the usual suspects of state that our tests mess up
* remove redundant tearDown functions
there's an after annotation on the trait to handle this
* use rector to upgrade tests for phpunit 11
* fixing CoversFunction for namespaced functions
* use FQNs in test attributes
2024-05-16 09:21:28 +10:00
Brett McBride a1489d3081
upgrade to phpunit 10 (#1258)
* upgrade to phpunit 10

* removing unintended commented code
2024-03-18 21:02:39 -04:00
Brett McBride 2601eaafe8
move trace flags consts into TraceFlags interface (#1028) 2023-06-07 22:34:13 +10:00
Brett McBride 904da75ee6
adding exporter + transport registry (#862)
* adding exporter + transport registry
to remove the hidden dependency between SDK and contrib, move all of the exporter knowledge out of
exporter factory, and invent a registry to hold those values. The registry can be added to by contrib
modules as part of composer autoloading.
This also allows users to override things like transports (eg, provide their own grpc transport).
Remove exporter's fromConnectionString as it's not in spec, and I couldn't get it to work nicely with the
registry idea.

* fixing up examples

* allow callables to be registered as factories
adding an example of replacing a registered transport factory with another implementation

* Registry to FactoryRegistry

* new relic exporter factory, tests

* review suggestions

* tidy

* change fromEnvironment() to create() in factories
2022-11-23 14:39:24 -05:00
Brett McBride ba9899278f
Sdk builder (#845)
Adding an SDK builder and example usage.
2022-10-31 08:09:01 +11:00
Tobias Bachert a167add2df
Drop general identity attributes by default (#843) 2022-10-12 09:12:54 +11:00
Brett McBride a3a47a6ba4
adding OTEL_SDK_DISABLED support (#833) 2022-10-07 16:47:54 +11:00
Brett McBride ea5b7c153e
return no-op span builder after shutdown (#765)
* return no-op span builder after shutdown
this completes a todo in code comments: when tracer shared state has shutdown, getting a span builder should return a no-op implementation

* adding unit test for post-shared-state-shutdown
2022-07-17 15:27:20 +02:00
Tobias Bachert 739f212ba9
Add instrumentation scope attributes (#735)
* Add attributes to instrumentation scope

* Remove `::getDefaultTracer()`

Instrumentation should use dedicated tracers.

* Remove SDK `::getTracer()` default name

Instrumentation should use API `TracerProvider` which requires providing a name.
2022-06-30 12:30:14 +02:00
Tobias Bachert 41f74d2aff
Make `AttributesInterface` immutable (#724)
* Cleanup `AttributesInterface`
- remove not required methods
- rename `::hasAttribute()` to `::has()` for consistency with `::get()`
* Remove public usage of `new Attributes()`
* Split `Attributes` into immutable attributes and mutable builder
* Remove `AttributesLimits`
* Remove `::incrementDroppedAttributesCount()` for now
Mainly useful for metrics sdk that has to rebuild filtered attributes.
* Remove obsolete cloning of attributes
* Update covers annotation
* Revert optional changes that might be controversial
2022-06-23 20:54:03 +10:00
Tobias Bachert a22f9f1077
Cleanup/fix context package (#711)
* Remove `Context::withValue()`

Creates a hidden `Scope` when called without `$parent`.

* Remove `Context::detach(Scope)`

* Remove static `Context::attach()`

* Add missing typehints

* Use loop instead of recursion

* Fix `MultiTextMapPropagator::extract()` clearing context

* Fix `TextMapPropagator::composite()` for named arguments

* Make `Context` constructor non-public

* Make `Context` and `ContextKey` final

* Fix `ArrayAccessGetterSetter`

Resolves inconsistencies in case-insensitive handling.

* Fix psalm

* Fix cannot mock final class `Context`

Revert after introducing ContextInterface?

* Apply feedback and remove obsolete parentheses

* Use psalm-suppress instead of assert
2022-06-16 08:17:59 -04:00
Yukti 25cfcfb6e9
Add phpunit annotations for compliance tests (#670)
* Add phpunit annotations
2022-05-07 09:02:29 +10:00
Brett McBride 4e3264578b
Fixing protobuf generation and InstrumentationScope (#665)
* updating proto generation
switching over to using opentelemetry-proto's own mechanism for generating protobuf interfaces, and
updating interfaces to latest version

* downgrade protobuf interfaces to 0.14.0
this is the latest version that seems to work with out grpc exporter, further
investigation required for 0.15.0+

* tidy up script

* renaming InstrumentationLibrary to InstrumentationScope and bumping protobuf
InstrumentationLibrary is now deprecated in favour of InstrumentationScope. Making this change
resolves issues with grpc+protobuf exports being ignored by the otel collector, so we now
can update the proto interfaces to latest.

* rename collector docker-compose file
2022-04-27 08:09:42 -04:00
lalex 3445917252
Add support for schemaUrl in TracerProvider and OTLP SpanConverter (#607)
* Add support for schemaUrl in TracerProvider and OTLP SpanConverter
2022-03-16 10:18:40 +11:00
Brett McBride 86ed4cff87
adding covers annotations to all tests (#540)
* adding covers annotations to all tests
* clock tests
* adding unit tests
* feedback
- cleaning up ValueRecorder tests
- ints are floats, so type-hint ValueRecorder::record and remove some checks
2022-01-07 09:33:08 +11:00
Brett McBride 56cf2db141
Separate integration and unit tests (#538)
* reorganise tests
moving tests under tests/Unit and tests/Integration, and updating namespaces
changing 'make test' to just run unit tests, and generate coverage off that
adding a 'make test-integration' to run integration tests (without coverage)
adding test-integration to 'make all'
adding a separate github action to run integration tests

* tidy 'make test'
make test is now a combination of test-unit and test-integration

* fixing 'make all'

* adding unit tests for TraceIdRatioBasedSampler
I grabbed a couple of the more unit-tests tests from the integration tests. Also starting to add some @covers
annotations to start to remove false coverage
2022-01-05 14:22:12 +01:00