Skip to content

Conversation

@fretz12
Copy link
Contributor

@fretz12 fretz12 commented Dec 4, 2025

What changed?

Add standalone activity metrics

Why?

Need standalone activity metrics for observability purposes

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Note

Adds comprehensive metrics and payload-size recording for standalone activities, introducing contextual request wrappers and wiring metrics through state transitions, timeout executors, and history APIs.

  • Activity component/state machine:
    • Introduces RequestWithContext carrying Token, MetricsHandler, NamespaceName, and BreakdownMetricsByTaskQueue and replaces prior request wrappers.
    • Records metrics on schedule, attempts, and terminal transitions (success, fail, cancel, timeouts), including ActivityStartToCloseLatency, ActivityScheduleToCloseLatency, success/fail/cancel/timeout counters, and per-timeout tags.
    • Adds recordPayloadSize(...) to emit payload sizes for input, heartbeat details, results, and failures.
  • Timeout and dispatch executors (chasm/lib/activity/activity_tasks.go):
    • Add timeoutTaskExecutorOptions (dynamic config, metrics, namespace registry); resolve namespace and emit timeout metrics during schedule/start/close/heartbeat timeouts and retries.
  • Activity handler:
    • Injects metrics.Handler and namespace.Registry; StartActivityExecution emits input payload size on scheduling.
  • History APIs (record/respond activity ops):
    • Pass RequestWithContext (token, metrics handler, namespace, breakdown setting) into chasm component calls.
  • Tests:
    • Update/add unit tests to validate metric emissions and payload-size recording across transitions and timeouts.

Written by Cursor Bugbot for commit 02c6aba. This will update automatically on new commits. Configure here.

@fretz12 fretz12 marked this pull request as ready for review December 4, 2025 23:19
@fretz12 fretz12 requested review from a team as code owners December 4, 2025 23:19
@fretz12
Copy link
Contributor Author

fretz12 commented Dec 4, 2025

cursor review

Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Overall this looks really good. I would consider restructuring the code as I suggested to make it easier to follow.

@dandavison dandavison force-pushed the heartbeat branch 4 times, most recently from 77b6f1c to 3ba3273 Compare December 9, 2025 03:05
@fretz12 fretz12 force-pushed the saa-metrics branch 3 times, most recently from 95f23c2 to 516247d Compare December 9, 2025 23:06
@fretz12 fretz12 requested a review from bergundy December 10, 2025 23:21
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Approving assuming that the attempt start to close metrics are emitted only when transitioning from a state that is not scheduled.

Base automatically changed from heartbeat to standalone-activity December 11, 2025 14:24
@fretz12 fretz12 marked this pull request as draft December 11, 2025 18:50
@fretz12 fretz12 marked this pull request as ready for review December 11, 2025 19:42
@fretz12 fretz12 merged commit 99b25e6 into standalone-activity Dec 12, 2025
55 of 56 checks passed
@fretz12 fretz12 deleted the saa-metrics branch December 12, 2025 04:59
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.

4 participants