Skip to content

docs: Add comprehensive metrics documentation#647

Merged
daniyelnnr merged 1 commit intomasterfrom
docs/diagnostics-metrics
Dec 31, 2025
Merged

docs: Add comprehensive metrics documentation#647
daniyelnnr merged 1 commit intomasterfrom
docs/diagnostics-metrics

Conversation

@daniyelnnr
Copy link
Contributor

@daniyelnnr daniyelnnr commented Dec 30, 2025

What is the purpose of this pull request?

This PR adds comprehensive documentation for the metrics system in @vtex/api. It introduces two new documentation files that provide detailed information about available metrics and guidance on migrating to the new DiagnosticsMetrics API.

What problem is this solving?

Currently, there is limited documentation about:

  • The available metrics in the @vtex/api library
  • How metrics are implemented (diagnostics-based vs legacy)
  • Best practices for migrating from MetricsAccumulator to DiagnosticsMetrics
  • Troubleshooting common metrics issues

This documentation addresses these gaps by providing a complete reference guide and migration documentation.

Screenshots or example usage

The documentation includes:

  • METRICS_CATALOG.md: Complete catalog of all available metrics organized by category (runtime, infrastructure, app, middleware)
  • METRICS_OVERVIEW.md: Migration guide with common patterns, best practices, and troubleshooting tips

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

This commit introduces two new markdown files: METRICS_CATALOG.md and METRICS_OVERVIEW.md. The METRICS_CATALOG.md provides a detailed catalog of all metrics available in the `@vtex/api` library, organized by their implementation types (diagnostics-based vs legacy). It includes sections on metrics architecture, visual summaries, and specific metrics for runtime, infrastructure, app, and middleware.

The METRICS_OVERVIEW.md serves as a migration guide for transitioning from the legacy MetricsAccumulator API to the new DiagnosticsMetrics API. It outlines the benefits of migration, common patterns, best practices, and troubleshooting tips, ensuring a smooth transition for developers. Both documents aim to enhance understanding and usage of metrics within VTEX IO applications.
│ ├── Disk: hits, total
│ └── Multilayer: hitRate, hits, total
└── 💰 Billing Metrics (console.log with __VTEX_IO_BILLING)
Copy link
Contributor

Choose a reason for hiding this comment

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

This billing 💰 do you know where it is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if that metric is still used, or where... Maybe @arturpimentel has more context about it

{ endpoint: '/users', status: 'success', region: 'us-east' }
```

### 5. Limit to 5 Attributes Maximum
Copy link
Contributor

Choose a reason for hiding this comment

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

We limit this value today, but do we show an error if the users goes beyond it? Or we just drop them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we display a warning when the application is linked/under development - so we're assuming the developer is aware.

@daniyelnnr daniyelnnr merged commit 09bc6a0 into master Dec 31, 2025
2 of 4 checks passed
@daniyelnnr daniyelnnr deleted the docs/diagnostics-metrics branch December 31, 2025 11:57
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.

2 participants