Skip to content

Export all DataPoints to console#430

Open
schiwekM wants to merge 1 commit into
mainfrom
fix/export-all-dps-to-console
Open

Export all DataPoints to console#430
schiwekM wants to merge 1 commit into
mainfrom
fix/export-all-dps-to-console

Conversation

@schiwekM
Copy link
Copy Markdown
Contributor

When a metric has two data points the console exporter currently only writes the last one to console. The PR fixes that.

@hyperspace-insights
Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Fix Console Exporter to Export All DataPoints

🐛 Bug Fix: The console metric exporter was only writing the last data point to the console when a metric had multiple data points. This PR fixes the issue by collecting all data points and logging them correctly.

Changes

  • lib/exporter/ConsoleMetricExporter.js: Updated the "other" metrics collection logic to accumulate all data points into an array instead of overwriting with each iteration. When logging, single-item arrays are unwrapped for cleaner output, while multiple data points are logged as an array.
  • test/metrics.test.js: Added a test case to verify that metrics with multiple data points (e.g., nodejs.eventloop.time) are logged as an array, while metrics with a single data point (e.g., nodejs.eventloop.utilization) are logged unwrapped.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.20.51

  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template
  • Event Trigger: pull_request.opened
  • Summary Prompt: Default Prompt
  • Correlation ID: 6b1870c7-a441-4462-860a-1eb46e4e2a77

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR correctly addresses the bug where only the last data point was written. Two issues were raised: (1) the other branch stores full datapoint objects (dp) instead of their values (dp.value), which is inconsistent with pool/queue handling, and (2) the unwrapping condition v.length === 1 should be guarded with Array.isArray(v) for robustness.

PR Bot Information

Version: 1.20.51

  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content
  • Event Trigger: pull_request.opened
  • Correlation ID: 6b1870c7-a441-4462-860a-1eb46e4e2a77

Comment thread lib/exporter/ConsoleMetricExporter.js
Comment thread lib/exporter/ConsoleMetricExporter.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant