Skip to content

Conversation

xuan-cao-swi
Copy link
Contributor

@xuan-cao-swi xuan-cao-swi commented Aug 15, 2025

Closes #1890

Description

Found a couple of issues while developing the test case:

  1. The current callback timeout applies to the entire set of callbacks of the instrument instead of each callback individually. This PR fixes that.
  2. A faulty callback that raises an error can crash the entire application. This update adds a safeguard to log the error while allowing the application to continue running. Also we shouldn't update to instrument and merge attributes if callback return non-numeric data or nil. (Reference)
  3. Replace Timeout.timeout with thread for executing the callback.
  4. Currently, each instrument supports only one view. Assigning multiple views to the same instrument can lead to inconsistent data_point values, as each view may modify the underlying data. This PR does not address the issue, but it will be resolved in the future.

Each metric_stream should be bound to its own instrument. While most functionality is tested through instruments, here we focus on fundamental correctness, which will be important when views and exemplars are updated.

@xuan-cao-swi xuan-cao-swi changed the title tests: add test case for metric_store and metric_view test: add test case for metric_store and metric_view Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Add missing unit test for metric_stream and metric_store
2 participants