Is there a way we can export opentelemetry spans to prometheus?
Is there a way we can export opentelemetry traces & spans from node.js app to prometheus ? or should we use histograms to record span durations, is there any better way other than this ?
For exporting spans in node you should use Span Exporters for example
https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-zipkin
https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-jaeger
https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-trace-otlp-http
Prometheus is Metric Exporter so this is meant for metrics only. Currently the metrics are experimental and are also in a process or refactoring. But you can still try them by checking this simple example https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/prometheus.
Typical analytic tool is capable of analysing the span duration without necessity of creating a metric. So having spans only would be already enough to have average / or 95 quantile etc. etc. for duration of your spans.
To have a better overview of metrics type and which one to use according to you needs I would encourage to start reading the spec here https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter - starting from Counter and checking also the mentioned Histogram.