Skip to content

ConsoleMetricExporter only outputs shallowly #4061

@anuraaga

Description

@anuraaga

What happened?

Steps to Reproduce

Enable ConsoleMetricExporter

Expected Result

See a full dump of metrics

Actual Result

Only see a shallow dump. For example, attributes are not visible

{
  descriptor: {
    name: 'http.client.duration',
    description: 'Measures the duration of outbound HTTP requests.',
    type: 'HISTOGRAM',
    unit: 'ms',
    valueType: 1
  },
  dataPointType: 1,
  dataPoints: [
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    },
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    },
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    },
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    },
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    },
    {
      attributes: [Object],
      startTime: [Array],
      endTime: [Array],
      value: [Object]
    }
  ]
}

Additional Details

console.dir is used to output, but it seems {depth: null} needs to be passed to it to get full output

https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/sdk-metrics/src/export/ConsoleMetricExporter.ts#L74

OpenTelemetry Setup Code

No response

package.json

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p4Bugs and spec inconsistencies which do not fall into a higher prioritizationup-for-grabsGood for taking. Extra help will be provided by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions