Skip to content

Add logging about export status to Metrics #1888

@kaylareopelle

Description

@kaylareopelle

As a follow-up to #1662 (comment):

Please add some debug output for the metrics exporter. Working with logs, if I set

OpenTelemetry.logger.level = Logger::DEBUG

Then I get

D, [2025-08-09T07:27:50.918650 #25729] DEBUG -- : Successfully exported 1 log records

But for metrics there is no output.

Let's add some information about successful export to Metrics. I think the Periodic Metric Reader's export method may be a good place to start:

# Helper function for the defined exporter to export metrics.
# It only exports if the collected metrics are not an empty array (collect returns an Array).
#
# @param [optional Numeric] timeout An optional timeout in seconds.
# @return [Integer] SUCCESS if no error occurred, FAILURE if a
# non-specific failure occurred
def export(timeout: nil)
@export_mutex.synchronize do
collected_metrics = collect
@exporter.export(collected_metrics, timeout: timeout || @export_timeout) unless collected_metrics.empty?
end
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions