-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add internal data -> OC compatibility shims to processors and exporters #667
Add internal data -> OC compatibility shims to processors and exporters #667
Conversation
a161f2d
to
a5274d1
Compare
// CreateMetricsCloningFanOutConnector is a placeholder function for now. | ||
// It supposed to create an old type connector or a new type connector based on type of provided metrics consumer. | ||
func CreateMetricsCloningFanOutConnector(baseMetricsConsumers []consumer.BaseMetricsConsumer) consumer.MetricsConsumer { | ||
// TODO: CreateMetricsCloningFanOutConnector doesn't support new type of consumers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this fails loudly if we attempt to use this function until this TODO is done? Otherwise this may become a hard to catch latent race bug if we forget to implement it. panic
is fine if we cannot return an error. I know we don't yet have any components that implement the new V2 interfaces, so the panic
will not be actually hit. It will just be a safeguard that we will discover the problem quickly if we forget about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Added panic
processor/fanoutconnector.go
Outdated
metricsConsumersV2 := make([]consumer.MetricsConsumerV2, 0, len(mcs)) | ||
anyMetricsConsumersV2 := false | ||
for _, mc := range mcs { | ||
metricsConsumer := mc.(consumer.MetricsConsumer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be?
metricsConsumer := mc.(consumer.MetricsConsumer) | |
metricsConsumer, ok := mc.(consumer.MetricsConsumer) | |
if ok ... |
Otherwise if mc
is consumer.MetricsConsumerV2
this will panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Caught it when adding tests as well. Moved it under the right condition.
processor/fanoutconnector.go
Outdated
traceConsumersV2 := make([]consumer.TraceConsumerV2, 0, len(tcs)) | ||
anyTraceConsumersV2 := false | ||
for _, tc := range tcs { | ||
traceConsumer := tc.(consumer.TraceConsumer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
} | ||
|
||
// Old type processor and a new type consumer usecase is not supported. | ||
return nil, errors.New("OC Traces -> internal data format translation is not supported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a TODO to also support this case? We now have Oc->internal translation so this should not be difficult to implement. This will allow us to mix old and new style components in the pipeline.
We can implement it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. Updated
a5274d1
to
c3d571e
Compare
Codecov Report
@@ Coverage Diff @@
## master #667 +/- ##
==========================================
- Coverage 75.98% 75.82% -0.17%
==========================================
Files 164 164
Lines 11614 11710 +96
==========================================
+ Hits 8825 8879 +54
- Misses 2365 2403 +38
- Partials 424 428 +4
Continue to review full report at Codecov.
|
c3d571e
to
0dc5567
Compare
0dc5567
to
4e40990
Compare
@dmitryax the build failed. |
a5b173c
to
abe42d4
Compare
In order to start migrating components from OC to internal data, all parts of the pipeline should be able to automatically convert back to OC if downstream component doesn't work with internal data structure
abe42d4
to
67a6c08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nit: the type assertions with else clauses or with returning in the ok case perhaps a better represented with type switches, and it makes the "default" case more explicit.
…lemetry#667) * Switch MinMaxSumCount to a mutex lock instead of StateLocker With multiple values being modified for each Update(), a single mutex lock and non-atomic operations ends up being faster than making each value update into an atomic operation. * Remove StateLocker implementation and comparison benchmarks * Remove field offset tests. No longer required with no atomics. Co-authored-by: Joshua MacDonald <[email protected]>
Fixes open-telemetry#657 With the changes in open-telemetry#667 and open-telemetry#669 to use a plain-old-mutex for concurrent access of Histogram and MinMaxSumCount aggregators, the StateLocker implementation is no longer used in the project. Co-authored-by: Joshua MacDonald <[email protected]>
Description:
In order to start migrating components from OC to internal data, all parts of the pipeline should be able to automatically convert back to OC if downstream component doesn't work with internal data structure yet
Testing: Unit tests
TODO: Support of mutating data processors will be added in a subsequent PR