From b17a956dd2e0c868806262df5445d6cb3013114d Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 28 Sep 2017 14:45:53 +0100 Subject: [PATCH] More docstring --- src/github.com/matrix-org/dendrite/common/httpapi.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/common/httpapi.go b/src/github.com/matrix-org/dendrite/common/httpapi.go index 67a2ac90e..76182bf0f 100644 --- a/src/github.com/matrix-org/dendrite/common/httpapi.go +++ b/src/github.com/matrix-org/dendrite/common/httpapi.go @@ -27,6 +27,7 @@ func MakeAuthAPI(metricsName string, deviceDB auth.DeviceDatabase, f func(*http. } // MakeExternalAPI turns a util.JSONRequestHandler function into an http.Handler. +// This is used for APIs that are called from the internet. func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse) http.Handler { h := util.MakeJSONAPI(util.NewJSONRequestHandler(f)) withSpan := func(w http.ResponseWriter, req *http.Request) { @@ -40,6 +41,9 @@ func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse } // MakeInternalAPI turns a util.JSONRequestHandler function into an http.Handler. +// This is used for APIs that are internal to dendrite. +// If we are passed a tracing context in the request headers then we use that +// as the parent of any tracing spans we create. func MakeInternalAPI(metricsName string, f func(*http.Request) util.JSONResponse) http.Handler { h := util.MakeJSONAPI(util.NewJSONRequestHandler(f)) withSpan := func(w http.ResponseWriter, req *http.Request) {