Converting proto version of ResourceMetric to the TypeScript version #5191
Unanswered
madhusudancs
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have a Typescript gRPC service (
receiver
) that receives a bunch of metrics from another service (sender
) that cannot directly send metrics to our OTel collectors (runs on a separate network). These metrics sent over gRPC use these protos: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.4.0/opentelemetry/proto/metrics/v1/metrics.proto#L56-L99Because we read this in Typescript code that implements gRPC handlers (
receiver
) for service methods with request embedding theMetricsData
, they are deserialized into Typescript types generated for the above protos. Now, in order to send this to the collector, in ourreceiver
we are using the metrics exporter'sexport()
method: https://github.com/open-telemetry/opentelemetry-js/blob/experimental/v0.54.2/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts#L136-L141.Unfortunately, this requires
metrics
to be a Typescript definedResourceMetrics
type that's not easily convertible from the proto version ofResourceMetrics
. I see converters in the other direction in the transformer packages.How do I convert this to the type that the exporter expects? Or is there another way that allows us to bypass this type conversion at all?
Beta Was this translation helpful? Give feedback.
All reactions