Add metrics implementation#750
Conversation
Codecov Report
@@ Coverage Diff @@
## main #750 +/- ##
============================================
+ Coverage 78.43% 79.56% +1.13%
- Complexity 1331 1679 +348
============================================
Files 153 213 +60
Lines 3278 4296 +1018
============================================
+ Hits 2571 3418 +847
- Misses 707 878 +171
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
brettmc
left a comment
There was a problem hiding this comment.
Initial review done, this looks great. I need to go over the spec in more detail, but so far this seems to be following the spec very closely.
To be discussed: naming of interfaces :)
2e6f4ff to
2659b9d
Compare
|
|
||
| namespace OpenTelemetry\SDK\Metrics; | ||
|
|
||
| interface DefaultAggregationProvider |
There was a problem hiding this comment.
| interface DefaultAggregationProvider | |
| interface DefaultAggregationProviderInterface |
|
I think I've reviewed this as well as I can. I'm happy to approve, and then it can get some real-world testing. Perhaps a first step might be to create an example that exports to the otel collector (when we do have a metrics exporter, I'm not sure that we do yet) |
| if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 500 && $response->getStatusCode() !== 408) { | ||
| return false; | ||
| } | ||
| } catch (RequestExceptionInterface $e) { |
There was a problem hiding this comment.
good spot to log an error or warning, as we get close to beta
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).
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.
- 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 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
- 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
3dd549e to
5c99ad0
Compare
…kMap` key going out of scope
Replaces the current implementation as it does not conform to the (current version of) the spec.
See
examples/metrics/basic.phpon how to use/create a meter provider.(Incomplete) todo list:
_bridge.php