Commit Graph

16 Commits

Author SHA1 Message Date
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 fc161a8548
migrate Clock classes to API (#1281)
* 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>
2024-04-29 10:28:06 +10:00
Brett McBride bb07aca7a2
upgrade psalm to v5 (#1246) 2024-03-04 06:58:09 -05:00
Brett McBride c735471aef
improve and expand otlp benchmark (#874)
- remove Mocker mocks, which were contributing extra time, and replace with no-op implementations
- adding extra benchmarks (batch vs simple, protobuf vs json)
2022-11-30 09:53:28 +11:00
Brett McBride 0b43fac729
refactor otlp exporter (#838)
* merge otlp exporters
continuing on from Nevay's work, this removes the individual OtlpHttp and OtlpGrpc exporters, and replaces with
Otlp\Exporter using a transport to manage grpc and http/protobuf complexity.

* tidy

* use mockery overload instead of prototype clone

* making all smoke-test examples work

* removing startBatch
verified that the call attributes have the same values when using TraceServiceClient

* tidy

* tidy

* Revert "use mockery overload instead of prototype clone"

This reverts commit bbb685b4d1.
Mocking proto-generated files segfaults with ext-protobuf (which is harder to diagnose when running in a child process, which
was required for fancy mockery mocking of "new". So, back to the prototype approach, and skip the tests if ext-protobuf enabled.

* tests without mocking protobuf

* test

* typo

* reverting FromConnectionStringInterface

* grpc headers

* revert to dumb transports, handle multiple protocols

* tidy, adding initial otlp json support

* self-review

* linting

* remove redundant interface

* Revert "remove redundant interface"

This reverts commit 350d40cdfe.

* fix getFloat

Co-authored-by: Tobias Bachert <git@b-privat.de>

* move withSignal into otlp-specific interface

* moving exporter/transport env handling into a new factory

* linting

* remove unused code

* tidy

* moving OtlpHttp into Otlp

* removing OtlpTransportFactoryInterface

* fix style

* fixing psalm error

* addressing review feedback

* replacing removed code

* fixing example

Co-authored-by: Tobias Bachert <git@b-privat.de>
2022-11-02 08:31:48 -04:00
Tobias Bachert 3866a82d92
Refactor transport layer (#831)
- move content type from `::send()` to transport property
- move otlp exporter to `Otlp\` namespace
2022-10-12 10:01:20 +11:00
Tobias Bachert c000590a53
Add intermediate transport layer between http/grpc client and exporter (#809)
* Add `Future::map()` to allow async processing without explicit async dependency

* Add `TransportInterface` abstraction

* Fix style

* Add transport and future tests

* Replace `HttpSpanExporterTrait` with `PsrTransport`

* Update transports

- ignore invalid compression
- add stream transport

* Handle partial success response
2022-09-14 08:36:49 -04:00
Tobias Bachert 2457c76015
Prevent concurrent `::export()` calls in span processor (#788)
* Prevent concurrent `::export()` calls in batch span processor
* Prevent concurrent `::export()` calls in simple span processor
* Allow disabling auto-flush in batch processor `::onEnd()`
* Include in-flight batches in queue limit
* Handle exporter exceptions to prevent termination of worker
* Use `LogsMessagesTrait`
2022-08-24 22:52:04 +10: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
Timo Michna 940f67f1c7
Refactor Attributes (#623)
* Move Attribute classes to Common namespace

* refactor AttributesTest

* Move Attribute classes to Common namespace in examples

* Introduce AttributeLimitsInterface

* Fix bug in total added values calculation

* Move compare test to correct test-class

* Apply CS

* Refactor Attributes

* Fix attributes in Benchmark

* Move AttributeLimits defaults to interface
2022-03-19 23:51:47 -04:00
Tobias Bachert 6ff577b417
Restructure API / SDK components (Attributes, Clock, Trace) (#521)
* Move Attributes and Clock out of /Trace namespace

Also needed for other components (metrics).

* Move Event and Link to SDK

* Move NoopTracer to API

* Remove `Attribute` abstraction

* Move `Attributes` to SDK by widening API attributes types to `iterable`

* Move `Clockinterface` to SDK

* Fix fqcn usage

* Readd `AttributesInterface` mock

* Move `TraceState` and W3C `TraceContextPropagator` to API
2022-01-01 18:51:36 +11:00
Brett McBride 44575d74e6
combining otlp span converters (#494)
* span converter rework
- combine otlp's grpc and http span converters into one
- adjust UsesSpanConverterTrait to always deal with arrays of spans, since span processors only accept arrays
Still to do:
- combine duplicated grpc/http span converter tests

* tidy

* make internal otlp span converted methods private
2021-12-06 23:24:34 -05:00
Brett McBride 2c1eb54946
Revert "Otlp centralised config (#488)" (#491)
This reverts commit 70d4dc25df.
2021-11-28 18:45:13 -05:00
Brett McBride 70d4dc25df
Otlp centralised config (#488)
* WIP

* Return Opts object so chain config

* More WIP

* combining otlp and grpc config
based on SeanHood's initial work for #383, I've fleshed out ConfigOpts, and used it to
simplify the configuration of the http and grpc exporters

* tidy

* changing compression to string, per spec

* update example - insecure defaults to false per spec

* moving more config into ConfigOpts
now both http and grpc exporters have almost the same constructor (todo Grpc accepts a SpanConverter
but http does not)

* removing unused SpanConverter param

* remove unused function

* test coverage for grpc exporter

Co-authored-by: Sean Hood <me@seanhood.co.uk>
2021-11-28 18:27:00 -05:00
Brett McBride 278f07525d
benchmark (#486)
* benchmark setup
some initial benchmarking tests, based loosely on the spec and with some inspiration from the python-otlp tests

* link to extensive go benchmarks for inspiration

* style

* psalm + phpstan

* remove accidental commit

* style fix

* more benchmarks

* undo accidental commit
2021-11-23 21:50:22 -05:00