Commit Graph

6 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 a1489d3081
upgrade to phpunit 10 (#1258)
* upgrade to phpunit 10

* removing unintended commented code
2024-03-18 21:02:39 -04:00
Tobias Bachert a7a28616b2
Move metric collection to `MeterProvider`-wide registry (#979)
* Add metric registry
* Use metric registry to record and collect metrics
* Minor cleanup
2023-04-27 08:15:20 +10:00
Tobias Bachert 23762dbbd3
Split metric collection from metric streams (#972)
Split metric collection from metric streams
2023-04-15 22:09:43 +10:00
Brett McBride e59f2c3cff
fixing phpunit 9.6 deprecations (#922)
phpunit v9.6 introduces a bunch of deprecations for things that will break in v10. This fixes the tests that are currently complaining.
2023-02-13 18:43:57 +11:00
Tobias Bachert 3ac64f6a28
Add metrics implementation (#750)
* Add metrics implementation

* Apply cs-fixer

* Downgrade to php 7.4

* [TODO] Suppress phan for now

* Add basic example

* [TODO] Remove outdated prometheus example for now

* Add otlp metric converter

* Add metric stream tests

* Downgrade to php 7.4 - fix asynchronous counter instrument type

* Add missing psalm-suppress annotations

* Add `ext-gmp` to composer suggest

* Fix `Sdk` -> `SDK`

* Remove `_bridge.php`

* Add array typehints

* Add `Interface` suffix to interfaces

* Add aggregation / attribute processor / staleness handler tests

* Apply rector

* Simplify filtered attribute processor

* Move instrument deduplication to meter

Allows removing view registry dependency from `MetricFactory`.
Should ideally turn of staleness handling for asynchronous instruments with permanently registered callbacks (drop all `::onStale()` callbacks and prevent addition of new callbacks).

* Allow injecting metric factory

* Release `::onStale()` callbacks if permanent observer callback registered

* Add `MultiObserver` tests

* Add php-doc for exporter temporality

* Resolve phan issues

* Add note about forward compatibility

* Add exemplar tests

* Remove special handling for callbacks being registered multiple times

Was mainly a side-effect of using `spl_object_id()`; lead to inconsistent behavior between providing same and identical callbacks; reverting back to incrementing index, keyspace is large enough.

* Add basic `Meter` / `MeterProvider` tests

* Add view `SelectionCriteria` tests

* Allow `MetricReader`s to configure default aggregation

- move default aggregation handling to metric reader / metric exporter
- move view registration to meter provider constructor
- move exemplar reservoir creation to aggregation to support user implementations
- remove `AttributeProcessor` from view as baggage access was dropped from spec
- deduplicate metric streams

* Add support for weakening `$this` reference of asynchronous callbacks

* Minor improvements

- add missing `Interface` suffix
- move callback destructors to metric observer to not detach if meter and meter provider are out of scope
- simplify `::viewRegistrationRequests()` by readding fallback view

* Add OTLP metric exporter

* Log export failure

* Minor improvements

- rename `MetricObserver::weakMap()` to `::destructors()` to better reflect usage`
- move `ReferenceCounter::acquire()` call to corresponding `MetricObserver::observe()` call for consistency
- cache instrumentation scope id in `Meter` to avoid repeated calls to `serialize()`
- remove obsolete instrument type check from `ViewProjection`, leftover from supporting aggregation per type

* Suppress `PhanAccessMethodInternal` due to being too strict for our usecase

* Add workaround for observer segfault if destruct is initiated by `WeakMap` key going out of scope

* Mark internal classes as internal

* Add in-memory and stream exporter

* Add metric converter test

* Add metric observer tests

* Add view registry tests

* Add metric reader tests

* Improve stream test coverage

* Improve meter test coverage

* Apply rector

* Add delayed staleness handler
2022-08-10 08:12:47 -04:00