feat(otlp-transformer)!: accept ResourceMetrics instead of ResoruceMetrics[] in metrics serializers #5159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
See #3276 - the old exporter bases did not support non-array export types so we worked around it by having a proxy exporter class that took
ResourceMetrics[]
that does not match thePushMetricExporter
interface (which requiresResourceMetrics
), and a base implementation that matches thePushMetricExporter
interface and converts theResourceMetrics
intoResourceMetrics[]
. As the issue linked above states, this was not optimal and looked quite confusing to most.However, with recent changes in #5031, #4542, #4971, #4895 and #4743, we don't need this workaround anymore and can now use a more direct approach.
This PR accomplishes this by aligining serializer to take
ResourceMetrics
as provided by thePushMetricExporter
interface instead ofResourceMetrics[]
and delegates wrappingResourceMetrics
to theISerializer
implementation.Fixes #3276
Breaking changes
ProtobufMetricsSerializer
now only acceptsResourceMetrics
instead ofResourceMetrics[]
to align withPushMetricExporter
requirementsJsonMetricsSerializer
now only acceptsResourceMetrics
instead ofResourceMetrics[]
to align withPushMetricExporter
requirementsType of change
How Has This Been Tested?