Skip to content

Add an observation behavior for logging, duration, and tracing #265

Description

@kzu

Summary

Ship one observation behavior that logs the call, records a System.Diagnostics.Metrics duration, and writes an Activity. Stop the timer when a returned Task or ValueTask completes, using Proceed.

API

The behavior takes an ILogger, the meter or instrument to update, and an optional redaction callback. The callback sees the invocation before any argument value is logged or tagged and can replace those values. Tags include the stunt type and the member name.

Behavior

  • Observation wraps the rest of the pipeline: one activity and one duration cover every retry attempt.
  • Run redaction before any argument is written.
  • On a synchronous exception, record the failure and the duration, then let the exception propagate.
  • On an awaitable, return it immediately and stop the timer when it completes, including fault and cancellation.

Acceptance

  • A completed call records one duration and one activity named for the member.
  • A redaction callback can drop an argument before it is logged.
  • The duration of a Task<T> includes the time until that task completes.

Composition

Outer to inner: observation, resilience, transaction, cache, target.

Back this issue
Back this issue

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions