Skip to content

feat: Log Many Metrics#69

Merged
monoxgas merged 1 commit into
mainfrom
feat/log-many-metrics
Jun 9, 2025
Merged

feat: Log Many Metrics#69
monoxgas merged 1 commit into
mainfrom
feat/log-many-metrics

Conversation

@monoxgas
Copy link
Copy Markdown
Contributor

@monoxgas monoxgas commented Jun 9, 2025

  • Add first attempt at log_metrics function.
  • Clean up some missing exports

Generated Summary:

  • Added log_metric and log_metrics functions for improved metrics logging.
  • log_metric supports additional parameters:
    • Step, origin, timestamp, mode, attributes, and to options allow more granular control.
    • Accepts both raw values and Metric objects for flexibility.
  • log_metrics offers the ability to log multiple metrics at once via dictionary or list of metric configurations.
  • Introduced MetricDict and MetricsDict for structured metric representation, enhancing API usability.
  • Updated various documentation to reflect these changes, including usage examples and parameter descriptions.
  • Improved internal consistency by renaming parameters from key to name in relevant functions.

This enhancement allows users to easily log and manage metrics, improving tracking of performance and resource usage during task execution.

This summary was generated with ❤️ by rigging

@monoxgas monoxgas requested a review from Copilot June 9, 2025 19:31
@dreadnode-renovate-bot dreadnode-renovate-bot Bot added area/docs Changes to documentation and guides type/docs Documentation updates and improvements labels Jun 9, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new log_metrics API for batch logging of metrics, standardizes naming from MetricDict to MetricsDict, and cleans up related exports and documentation.

  • Introduce log_metrics method with overloads for dict and list inputs
  • Rename old MetricDict alias for mapping to MetricsDict and add MetricDict TypedDict for individual metric configs
  • Export log_metrics in the package root and update all docs to cover the new API

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dreadnode/tracing/span.py Updated imports and type hints from MetricDict to MetricsDict
dreadnode/metric.py Added MetricDict TypedDict and renamed mapping alias to MetricsDict
dreadnode/main.py Added log_metrics implementation, updated log_metric rename, expanded docstring
dreadnode/init.py Export log_metrics (and log_outputs) at package root
docs/usage/metrics.mdx Updated usage example to show log_metrics and added a Tip
docs/sdk/metric.mdx Documented new MetricsDict and ScorerResult; added MetricDict section
docs/sdk/main.mdx Added detailed API reference and examples for log_metrics
Comments suppressed due to low confidence (5)

dreadnode/metric.py:22

  • [nitpick] The name MetricDict for a TypedDict may be confused with the plural MetricsDict; consider renaming to MetricConfig or similar to clarify its purpose.
class MetricDict(te.TypedDict, total=False):

dreadnode/main.py:940

  • You’ve changed the parameter from key to name which is a breaking API change; consider providing a deprecated alias for key to ease client upgrades.
+        name: str,

docs/sdk/metric.mdx:221

  • The MetricDict section lacks a code snippet showing its fields or usage; adding a proper example or the TypedDict definition would improve clarity.
+MetricDict

dreadnode/main.py:1090

  • There are no tests covering the new log_metrics method; adding unit tests for both dict and list inputs will ensure it behaves as expected.
def log_metrics(

dreadnode/init.py:29

  • Ensure that log_outputs is actually implemented on DEFAULT_INSTANCE or remove this export to prevent an AttributeError at runtime.
log_outputs = DEFAULT_INSTANCE.log_outputs

@monoxgas monoxgas merged commit 4af3388 into main Jun 9, 2025
9 checks passed
@monoxgas monoxgas deleted the feat/log-many-metrics branch June 9, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Changes to documentation and guides type/docs Documentation updates and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants