Skip to content

Commit 75bd723

Browse files
authored
fix: ConsoleMetricExporter Should Not Export Shallowly (#4522)
* fix: (ConsoleMetricExporter): Increase console log depth to get useful information from metrics. * update: add contribution to changelog. * Update CHANGELOG.md
1 parent 3920b15 commit 75bd723

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
1313

1414
### :bug: (Bug Fix)
1515

16+
* 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
17+
1618
### :books: (Refine Doc)
1719

1820
### :house: (Internal)

packages/sdk-metrics/src/export/ConsoleMetricExporter.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ export class ConsoleMetricExporter implements PushMetricExporter {
7171
): void {
7272
for (const scopeMetrics of metrics.scopeMetrics) {
7373
for (const metric of scopeMetrics.metrics) {
74-
console.dir({
75-
descriptor: metric.descriptor,
76-
dataPointType: metric.dataPointType,
77-
dataPoints: metric.dataPoints,
78-
});
74+
console.dir(
75+
{
76+
descriptor: metric.descriptor,
77+
dataPointType: metric.dataPointType,
78+
dataPoints: metric.dataPoints,
79+
},
80+
{ depth: null }
81+
);
7982
}
8083
}
8184

0 commit comments

Comments
 (0)