Skip to content

feat: keep Effect metrics aligned with semantic conventions - #55

Merged
yordis merged 10 commits into
mainfrom
yordis/feat-effect-metrics-template
Oct 26, 2026
Merged

yordis merged 10 commits into
mainfrom
yordis/feat-effect-metrics-template

Conversation

@yordis

@yordis yordis commented Oct 25, 2026 •

Copy link
Copy Markdown
Member
  • Effect applications need registry-governed metrics that fit their existing instrumentation and export runtime.
  • Callers need compile-time attribute contracts without handwritten telemetry keys or an unchecked recording path.
  • Consistent units and bounded histogram buckets prevent telemetry drift across consumers.

@cursor

cursor Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
New codegen surface affects recorded metric units, labels, and histogram buckets in consuming apps, though behavior is heavily fixture- and consumer-tested against Effect 4.0.5.

Overview
Adds a new templates/code/typescript_effect Weaver package that emits a single metrics.ts module: private effect/Metric instruments, shared enum constants, attribute types, and update* helpers that map camelCase fields to registry wire keys while keeping instruments non-exported.

Generation is driven by weaver.yaml jq filters plus metrics.ts.j2, covering counters/up-down counters/gauges/histograms, explicit histogram boundaries (per-metric aggregation or param defaults by unit), stability/deprecated filtering, and hard failures for unsupported types, refinements, reserved names, and identifier collisions. Time-unit histograms accept Duration.Duration via Metric.mapInput with unit-specific conversion (including direct nanosecond paths for us/ns).

CI and local validation mirror Go/Rust: buildscripts/check_typescript_effect_output.sh stages expected outputs and consumer.test.ts files into a temp npm project (pinned Effect 4.0.5 / TypeScript 7), runs tsc, then node --test. mise run weaver:test:typescript_effect is wired into the default test aggregate and the Checks workflow; docs list the package alongside Go and Rust.

Reviewed by Cursor Bugbot for commit e2c8328. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 164 files, which is 64 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 280fd288-a611-48bd-8daa-0e6717fd026f
Commits

Reviewing files that changed from the base of the PR and between e8af2cc and e2c8328.

Files ignored due to path filters: 1
  • buildscripts/typescript_effect/package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 164
  • .config/mise/tasks/weaver/test/_default
  • .config/mise/tasks/weaver/test/typescript_effect
  • .github/workflows/checks.yml
  • AGENTS.md
  • CONTRIBUTING.md
  • README.md
  • buildscripts/check_typescript_effect_output.sh
  • buildscripts/typescript_effect/package.json
  • buildscripts/typescript_effect/tsconfig.json
  • templates/code/typescript_effect/README.md
  • templates/code/typescript_effect/docs/explanation.md
  • templates/code/typescript_effect/docs/how-to/generate-metrics.md
  • templates/code/typescript_effect/docs/reference.md
  • templates/code/typescript_effect/metrics.ts.j2
  • templates/code/typescript_effect/tests/attribute_names/consumer.test.ts
  • templates/code/typescript_effect/tests/attribute_names/expected/metrics.ts
  • templates/code/typescript_effect/tests/attribute_names/registry/manifest.yaml
  • templates/code/typescript_effect/tests/attribute_names/registry/model.yaml
  • templates/code/typescript_effect/tests/custom_boundaries/consumer.test.ts
  • templates/code/typescript_effect/tests/custom_boundaries/expected/metrics.ts
  • templates/code/typescript_effect/tests/custom_boundaries/params.yaml
  • templates/code/typescript_effect/tests/custom_boundaries/registry/manifest.yaml
  • templates/code/typescript_effect/tests/custom_boundaries/registry/model.yaml
  • templates/code/typescript_effect/tests/empty/expected/metrics.ts
  • templates/code/typescript_effect/tests/empty/registry/manifest.yaml
  • templates/code/typescript_effect/tests/empty/registry/model.yaml
  • templates/code/typescript_effect/tests/error_aggregation_counter/expected-error.txt
  • templates/code/typescript_effect/tests/error_aggregation_counter/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_aggregation_counter/registry/model.yaml
  • templates/code/typescript_effect/tests/error_aggregation_fields/expected-error.txt
  • templates/code/typescript_effect/tests/error_aggregation_fields/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_aggregation_fields/registry/model.yaml
  • templates/code/typescript_effect/tests/error_aggregation_method/expected-error.txt
  • templates/code/typescript_effect/tests/error_aggregation_method/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_aggregation_method/registry/model.yaml
  • templates/code/typescript_effect/tests/error_array_attribute/expected-error.txt
  • templates/code/typescript_effect/tests/error_array_attribute/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_array_attribute/registry/model.yaml
  • templates/code/typescript_effect/tests/error_attribute_field_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_attribute_field_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_attribute_field_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_attribute_identifier/expected-error.txt
  • templates/code/typescript_effect/tests/error_attribute_identifier/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_attribute_identifier/registry/model.yaml
  • templates/code/typescript_effect/tests/error_boundaries_empty/expected-error.txt
  • templates/code/typescript_effect/tests/error_boundaries_empty/params.yaml
  • templates/code/typescript_effect/tests/error_boundaries_empty/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_boundaries_empty/registry/model.yaml
  • templates/code/typescript_effect/tests/error_boundaries_order/expected-error.txt
  • templates/code/typescript_effect/tests/error_boundaries_order/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_boundaries_order/registry/model.yaml
  • templates/code/typescript_effect/tests/error_boundaries_type/expected-error.txt
  • templates/code/typescript_effect/tests/error_boundaries_type/params.yaml
  • templates/code/typescript_effect/tests/error_boundaries_type/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_boundaries_type/registry/model.yaml
  • templates/code/typescript_effect/tests/error_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_attribute_type_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_attribute_type_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_attribute_type_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_import_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_import_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_import_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_member_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_member_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_member_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_member_identifier/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_member_identifier/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_member_identifier/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_number_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_number_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_number_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_record_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_record_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_record_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_runtime_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_runtime_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_runtime_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_enum_symbol_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_enum_symbol_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_enum_symbol_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_filtered_enum/expected-error.txt
  • templates/code/typescript_effect/tests/error_filtered_enum/params.yaml
  • templates/code/typescript_effect/tests/error_filtered_enum/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_filtered_enum/registry/model.yaml
  • templates/code/typescript_effect/tests/error_filtered_required/expected-error.txt
  • templates/code/typescript_effect/tests/error_filtered_required/params.yaml
  • templates/code/typescript_effect/tests/error_filtered_required/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_filtered_required/registry/model.yaml
  • templates/code/typescript_effect/tests/error_helper_collision/expected-error.txt
  • templates/code/typescript_effect/tests/error_helper_collision/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_helper_collision/registry/model.yaml
  • templates/code/typescript_effect/tests/error_identifier/expected-error.txt
  • templates/code/typescript_effect/tests/error_identifier/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_identifier/registry/model.yaml
  • templates/code/typescript_effect/tests/error_optional_prototype/expected-error.txt
  • templates/code/typescript_effect/tests/error_optional_prototype/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_optional_prototype/registry/model.yaml
  • templates/code/typescript_effect/tests/error_prototype_field/expected-error.txt
  • templates/code/typescript_effect/tests/error_prototype_field/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_prototype_field/registry/model.yaml
  • templates/code/typescript_effect/tests/error_prototype_key/expected-error.txt
  • templates/code/typescript_effect/tests/error_prototype_key/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_prototype_key/registry/model.yaml
  • templates/code/typescript_effect/tests/error_refinement/expected-error.txt
  • templates/code/typescript_effect/tests/error_refinement/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_refinement/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_arguments/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_arguments/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_arguments/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_eval/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_eval/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_eval/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_identifier/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_identifier/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_identifier/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_time_unit/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_time_unit/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_time_unit/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_undefined/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_undefined/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_undefined/registry/model.yaml
  • templates/code/typescript_effect/tests/error_reserved_unit/expected-error.txt
  • templates/code/typescript_effect/tests/error_reserved_unit/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_reserved_unit/registry/model.yaml
  • templates/code/typescript_effect/tests/error_same_name_refinement/expected-error.txt
  • templates/code/typescript_effect/tests/error_same_name_refinement/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_same_name_refinement/registry/model.yaml
  • templates/code/typescript_effect/tests/error_shadow_attributes/expected-error.txt
  • templates/code/typescript_effect/tests/error_shadow_attributes/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_shadow_attributes/registry/model.yaml
  • templates/code/typescript_effect/tests/error_shadow_labels/expected-error.txt
  • templates/code/typescript_effect/tests/error_shadow_labels/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_shadow_labels/registry/model.yaml
  • templates/code/typescript_effect/tests/error_shadow_value/expected-error.txt
  • templates/code/typescript_effect/tests/error_shadow_value/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_shadow_value/registry/model.yaml
  • templates/code/typescript_effect/tests/error_value_type/expected-error.txt
  • templates/code/typescript_effect/tests/error_value_type/registry/manifest.yaml
  • templates/code/typescript_effect/tests/error_value_type/registry/model.yaml
  • templates/code/typescript_effect/tests/filtering/expected/metrics.ts
  • templates/code/typescript_effect/tests/filtering/params.yaml
  • templates/code/typescript_effect/tests/filtering/registry/manifest.yaml
  • templates/code/typescript_effect/tests/filtering/registry/model.yaml
  • templates/code/typescript_effect/tests/imported/consumer.test.ts
  • templates/code/typescript_effect/tests/imported/dependency/manifest.yaml
  • templates/code/typescript_effect/tests/imported/dependency/model.yaml
  • templates/code/typescript_effect/tests/imported/expected/metrics.ts
  • templates/code/typescript_effect/tests/imported/registry/manifest.yaml
  • templates/code/typescript_effect/tests/imported/registry/model.yaml
  • templates/code/typescript_effect/tests/metrics/consumer.test.ts
  • templates/code/typescript_effect/tests/metrics/expected/metrics.ts
  • templates/code/typescript_effect/tests/metrics/registry/manifest.yaml
  • templates/code/typescript_effect/tests/metrics/registry/model.yaml
  • templates/code/typescript_effect/tests/shadow_measurement/consumer.test.ts
  • templates/code/typescript_effect/tests/shadow_measurement/expected/metrics.ts
  • templates/code/typescript_effect/tests/shadow_measurement/registry/manifest.yaml
  • templates/code/typescript_effect/tests/shadow_measurement/registry/model.yaml
  • templates/code/typescript_effect/tests/time_units/consumer.test.ts
  • templates/code/typescript_effect/tests/time_units/expected/metrics.ts
  • templates/code/typescript_effect/tests/time_units/registry/manifest.yaml
  • templates/code/typescript_effect/tests/time_units/registry/model.yaml
  • templates/code/typescript_effect/weaver.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc233ce. Configure here.

@yordis
yordis merged commit 7d8a200 into main Oct 26, 2026
7 checks passed
@yordis
yordis deleted the yordis/feat-effect-metrics-template branch October 26, 2026 20:15
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