Skip to content

ffi/metrics: provide option to enable expensive metric calculations #1524

@demosdemon

Description

@demosdemon

AvalancheGo has this flag. Firewood should provide this flag as well. This can be done either when opening the database or configuration metrics. If done when configuring metrics, this can be done by setting global static atomic bool that is read with relaxed ordering when determining whether or not to calculate the metrics. If done when opening the database, this can be added as an open option but will need to be threaded through the codebase everywhere the option is needed.

The former option is easier but the later option is preferred long-term but is more invasive.

I am also open to a convoluted third option where we use Thread-Local Storage (TLS) to set a context variable when entering database methods and then check that TLS for the context variable when needed which prevents tainting global state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    observabilitylogging, tracing and metrics

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions