   ### Dynamic instrumentation
 
   If you want to instrument a piece of code, but the endpoint that should
-  instrument it (the one that contains the `instrument/3` macro you want to use)
+  instrument it (the one that contains the `c:instrument/3` macro you want to use)
   is not known at compile time, only at runtime, you can use the
   `Phoenix.Endpoint.instrument/4` macro. Refer to its documentation for more
   information.
 
   """
 
+  @type topic :: String.t
+  @type event :: String.t
+  @type msg :: map
+
+  # Configuration
+
+  @doc """
+  Starts the Endpoint supervision tree.
+
+  Starts endpoint's configuration cache and possibly the servers for
+  handling requests.
+  """
+  @callback start_link() :: Supervisor.on_start
+
+  @doc """
+  Access the endpoint configuration given by key.
+  """
+  @callback config(key :: atom, default :: term) :: term
+
+  @doc """
+  Reload the endpoint configuration on application upgrades.
+  """
+  @callback config_change(changed :: term, removed :: term) :: term
+
+  @doc """
+  Initialize the endpoint configuration.
+
+  Invoked when the endpoint supervisor starts, allows dynamically
+  configuring the endpoint from system environment or other runtime sources.
+  """
+  @callback init(:supervisor, config :: Keyword.t) :: {:ok, Keyword.t}
+
+  # Paths and URLs
+
+  @doc """
+  Generates the endpoint base URL, but as a `URI` struct.
+  """
+  @callback struct_url() :: URI.t
+
+  @doc """
+  Generates the endpoint base URL without any path information.
+  """
+  @callback url() :: String.t
+
+  @doc """
+  Generates the path information when routing to this endpoint.
+  """
+  @callback path(path :: String.t) :: String.t
+
+  @doc """
+  Geerates the static URL without any path information.
+  """
+  @callback static_url() :: String.t
+
+  @doc """
+  Generates a route to a static file in `priv/static`
+  """
+  @callback static_path(path :: String.t) :: String.t
+
+  # Channels
+
+  @doc """
+  Subscribes the caller to the given topic.
+
+  See `Phoenix.PubSub.subscribe/3` for options.
+  """
+  @callback subscribe(topic, opts :: Keyword.t) :: :ok | {:error, term}
+
+  @doc """
+  Unsubscribes the caller from the given topic.
+  """
+  @callback unsubscribe(topic) :: :ok | {:error, term}
+
+  @doc """
+  Broadcasts a `msg` as `event` in the given `topic`.
+  """
+  @callback broadcast(topic, event, msg) :: :ok | {:error, term}
+
+  @doc """
+  Broadcasts a `msg` as `event` in the given `topic`.
+
+  Raises in case of failures.
+  """
+  @callback broadcast!(topic, event, msg) :: :ok | no_return
+
+  @doc """
+  Broadcasts a `msg` from the given `from` as `event` in the given `topic`.
+  """
+  @callback broadcast_from(from :: pid, topic, event, msg) :: :ok | {:error, term}
+
+  @doc """
+  Broadcasts a `msg` from the given `from` as `event` in the given `topic`.
+
+  Raises in case of failures.
+  """
+  @callback broadcast_from!(from :: pid, topic, event, msg) :: :ok | no_return
+
+  # Instrumentation
+
+  @doc """
+  Allows instrumenting operation defined by `function`.
+
+  `runtime_metadata` may be omitted and defaults to `nil`.
+
+  Read more about instrumentation in the "Instrumentation" section.
+  """
+  @macrocallback instrument(instrument_event :: Macro.t, runtime_metadata :: Macro.t, funcion :: Macro.t) :: Macro.t
+
   @doc false
   defmacro __using__(opts) do
     quote do
+      @behaviour Phoenix.Endpoint
+
       unquote(config(opts))
       unquote(pubsub())
       unquote(plug())

  called like this:

      require MyApp.Endpoint
      MyApp.Endpoint.instrument :render_view, %{view: "index.html"}, fn ->
        # actual view rendering
      end

  All the instrumenter modules that export a `render_view/3` function will be
  notified of the event so that they can perform their respective actions.

  the time you will want to define (at least) two separate clauses for each
  event callback, one for the "before" and one for the "after" callbacks.

  All event callbacks are run in the same process that calls the `c:instrument/3`
  macro; hence, instrumenters should be careful to avoid performing blocking actions.
  If an event callback fails in any way (exits, throws, or raises), it won't
  affect anything as the error is caught, but the failure will be logged. Note
