Skip to content

Introduce structured tracing / metrics surface for observability #31

Description

@P3az3

Problem Statement campaign uses raw env.events().publish for client-visible state. There is no internal framework for log lines, error breadcrumbs, or counters. On a faulty production deployment, debugging requires painstakingly reading on-chain events.

Why it matters Soroban hostside tracing is unavailable in production (no eprintln!); internal observability is best expressed through additional public events and typed structs.

Expected Outcome Add a structured event diagnostics_emit (off-by-default, gated behind a feature flag) that captures:

  • Latency budget used per call.
  • CPU/memory envelope per call.
  • Error code on panic.

Also, a public metrics_view(env) -> CampaignMetrics entrypoint that returns diagnostic counters (counters for donate_received_total, donate_panicked_total_by_code, etc.) if a feature flag is enabled.

Acceptance Criteria

  • New feature flag diag (default off).
  • New event variant diagnostics_emit (gated by the flag).
  • New view entrypoint metrics_view.
  • Test exercises flag-off (no events emitted) and flag-on (events emitted).
  • Documentation in docs/observability.md includes a user-facing JSON schema.

Implementation Notes

  • The flag toggle must be cheap; use #[cfg(feature = "diag")].

Affected Files / Modules

  • campaign/src/lib.rs
  • campaign/Cargo.toml (feature)
  • New: docs/observability.md

Dependencies — None.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26featureNew capability or public surface.observabilityTracing, metrics, dashboarding surface.priority/p2Should-do in current quarter.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions