Skip to content

Commit

Permalink
fix: ConsoleMetricExporter Should Not Export Shallowly (#4522)
Browse files Browse the repository at this point in the history
* fix: (ConsoleMetricExporter): Increase console log depth to get useful information from metrics.

* update: add contribution to changelog.

* Update CHANGELOG.md
  • Loading branch information
JacksonWeber committed Mar 6, 2024
1 parent 3920b15 commit 75bd723
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

* fix(sdk-metrics): increase the depth of the output to the console such that objects in the metric are printed fully to the console [#4522](https://github.com/open-telemetry/opentelemetry-js/pull/4522) @JacksonWeber

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
13 changes: 8 additions & 5 deletions packages/sdk-metrics/src/export/ConsoleMetricExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ export class ConsoleMetricExporter implements PushMetricExporter {
): void {
for (const scopeMetrics of metrics.scopeMetrics) {
for (const metric of scopeMetrics.metrics) {
console.dir({
descriptor: metric.descriptor,
dataPointType: metric.dataPointType,
dataPoints: metric.dataPoints,
});
console.dir(
{
descriptor: metric.descriptor,
dataPointType: metric.dataPointType,
dataPoints: metric.dataPoints,
},
{ depth: null }
);
}
}

Expand Down

0 comments on commit 75bd723

Please sign in to comment.