# `ScoutApm.TrackedRequest`

Stores information about a single request, as the request is happening.
Attempts to do minimal processing. Its job is only to collect up information.
Once the request is finished, the last layer will be stopped - and we can
send this whole data structure off to be processed.

A quick visual of how this looks:

START Controller (this is scope.)
  TRACK Ecto

  START View
    TRACK Ecto

    START Partial View
    STOP Partial View
  STOP View
STOP Controller

# `change_collector_fn`

# `change_collector_fn`

# `ignore`

Marks the current tracked request as ignored, preventing it from being sent or included
in any metrics. It can be used in both web requests and jobs.

If you'd like to sample only 75% of your application's web requests, a Plug is a good
way to do that:

    defmodule MyApp.ScoutSamplingPlug do
      @behaviour Plug
      def init(_), do: []

      def call(conn, _opts) do
        # capture 75% of requests
        if :rand.uniform() > 0.75 do
          ScoutApm.TrackedRequest.ignore()
        end
      end
    end

Instrumented jobs can also be ignored by conditionally calling this function:

    deftransaction multiplication_job(num1, num2) do
      if num1 < 0 do
        ScoutApm.TrackedRequest.ignore()
      end

      num1 * num2
    end

# `mark_error`

# `mark_error`

# `new`

# `record_context`

# `record_context`

# `rename`

# `start_layer`

# `start_layer`

# `stop_layer`

# `stop_layer`

# `stop_layer`

# `track_layer`

# `track_layer`

# `update_current_layer`

# `update_current_layer`

Not intended for public use. Applies a function that takes an Layer, and
returns a Layer to the currently tracked layer. Building block for things
like: "update_desc"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
