Skip to content

TRAC-469: add support for wae metrics#15

Merged
rtalvarez merged 1 commit into
masterfrom
wae-metrics
May 19, 2026
Merged

TRAC-469: add support for wae metrics#15
rtalvarez merged 1 commit into
masterfrom
wae-metrics

Conversation

@rtalvarez

@rtalvarez rtalvarez commented May 18, 2026

Copy link
Copy Markdown
Member

Pull Request Template

Description

Adds support for fetching Analytics Engine metrics via the SQL API, and adds a converter into prometheus metrics, reading from WAE_DATASET_SCRIPT_NAME_ENV datastore.

Generic implementation exposes label, metric_type and script_name, assuming the worker knows the shape of their data.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Other (please describe):

Testing

Verified the exporter is able to execute the API call

DEBUG[2026-05-18 10:04:29] func:main.(*WAEClient).Query file:wae.go WAE query (account=XYZ):
                        SELECT
                                index1 AS metric_type,
                                blob1 AS label,
                                SUM(_sample_interval * double1) / SUM(_sample_interval) AS avg_duration_ms,
                                SUM(_sample_interval) AS total_requests
                        FROM script_name
                        WHERE timestamp > NOW() - INTERVAL '5' MINUTE
                        GROUP BY index1, blob1
                        FORMAT JSON

I have also verified that these show up in localhost:8080/metrics with the right format

Code Quality

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Before Submitting

Please ensure you have completed the following before submitting your PR:

# Run comprehensive tests
make pr-tests

If the above command fails, please fix the issues before submitting your PR.

Additional Notes

Add any other context about the pull request here.

@rtalvarez
rtalvarez marked this pull request as ready for review May 19, 2026 14:11
Comment thread README.md

### Notes

- The WAE aggregation window is 5 minutes. If your worker is low-traffic, expect series to disappear when traffic doesn't land in the window.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🍹 I would also say that it may be inaccurate as well. We've seen where KV reports "bad" metrics, as in high latency, due to a high-ish aggregation window.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, honestly we'll see how it goes. we can always make this value configurable in case we need to tweak it w/o code change

@rtalvarez
rtalvarez merged commit 6acd059 into master May 19, 2026
3 checks passed
@rtalvarez
rtalvarez deleted the wae-metrics branch May 19, 2026 14:52
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