     result
   end
 
+  @doc """
+  Instrument a function.
+
+      def call do
+        Appsignal.instrument("foo.bar", fn ->
+          :timer.sleep(1000)
+        end)
+      end
+
+  When passing a function that takes an argument, the function is called with
+  the created span to allow adding extra information.
+
+      def call(params) do
+        Appsignal.instrument("foo.bar", fn span ->
+          Appsignal.Span.set_sample_data(span, "params", params)
+          :timer.sleep(1000)
+        end)
+      end
+
+  """
   def instrument(name, fun) do
     instrument(fn span ->
       @span.set_name(span, name)

    :ok = Appsignal.Nif.add_distribution_value(key, value, encoded_tags)
  end

  def instrument(fun) do
    span = @tracer.create_span("http_request", @tracer.current_span)


  @doc """
  Add a value to a distribution

  Use this to collect multiple data points that will be merged into a graph.
  """
  @spec add_distribution_value(String.t(), float | integer, map) :: :ok
  def add_distribution_value(key, value, tags \\ %{})
