summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriilyak <iilyak@users.noreply.github.com>2020-01-30 06:33:38 -0800
committerGitHub <noreply@github.com>2020-01-30 06:33:38 -0800
commit7e0c5bbd498d32ce4974169fb848160d4ec4442a (patch)
treed7368b08dd2816cac98a19e2e0836f2ff13957e4
parent7045d6207ac5f162420cc169e0d27fadcb2beca6 (diff)
parentbd3c021bd887f4233c6c9a9fff121fa9c22af84e (diff)
downloadcouchdb-7e0c5bbd498d32ce4974169fb848160d4ec4442a.tar.gz
Merge pull request #2494 from cloudant/add-http-reporter
Add http reporter
-rw-r--r--rebar.config.script4
-rw-r--r--rel/overlay/etc/default.ini12
-rw-r--r--src/ctrace/README.md18
-rw-r--r--src/ctrace/src/ctrace_config.erl38
4 files changed, 56 insertions, 16 deletions
diff --git a/rebar.config.script b/rebar.config.script
index 2fde9c593..f7ebcb5d3 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -121,13 +121,13 @@ DepDescs = [
{folsom, "folsom", {tag, "CouchDB-0.8.3"}},
{hyper, "hyper", {tag, "CouchDB-2.2.0-4"}},
{ibrowse, "ibrowse", {tag, "CouchDB-4.0.1-1"}},
-{jaeger_passage, "jaeger-passage", {tag, "CouchDB-0.1.13-1"}},
+{jaeger_passage, "jaeger-passage", {tag, "CouchDB-0.1.14-1"}},
{jiffy, "jiffy", {tag, "CouchDB-0.14.11-2"}},
{local, "local", {tag, "0.2.1"}},
{mochiweb, "mochiweb", {tag, "v2.19.0"}},
{meck, "meck", {tag, "0.8.8"}},
{passage, "passage", {tag, "0.2.6"}},
-{thrift_protocol, "thrift-protocol", {tag, "0.1.3"}},
+{thrift_protocol, "thrift-protocol", {tag, "0.1.5"}},
%% TMP - Until this is moved to a proper Apache repo
{erlfdb, "erlfdb", {branch, "master"}}
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 63cb443fc..592445c28 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -568,13 +568,19 @@ min_priority = 2.0
[tracing]
;
; Configuration settings for the `ctrace` OpenTracing
-; API.
-;
+; API. There are two reporter which we support.
+; - jaeger.thrift over udp
+; - jaeger.thrift over http
+; ## Common settings
; enabled = false ; true | false
+; app_name = couchdb ; value to use for the `location.application` tag
+; protocol = udp ; udp | http - which reporter to use
+; ## jaeger.thrift over udp reporter
; thrift_format = compact ; compact | binary
; agent_host = 127.0.0.1
; agent_port = 6831
-; app_name = couchdb ; value to use for the `location.application` tag
+; ## jaeger.thrift over udp reporter
+; endpoint = http://127.0.0.1:14268
[tracing.filters]
;
diff --git a/src/ctrace/README.md b/src/ctrace/README.md
index 3172f268b..4b0238b14 100644
--- a/src/ctrace/README.md
+++ b/src/ctrace/README.md
@@ -120,9 +120,23 @@ Configuration
Traces are configured using standard CouchDB ini file based configuration.
There is a global toggle `[tracing] enabled = true | false` that switches
tracing on or off completely. The `[tracing]` section also includes
-configuration for where to send trace data.
+configuration for where to send trace data. There are two reporters which we
+support.
-An example `[tracing]` section
+The thrift over udp reporter (this is the default) has following configuration
+options:
+
+- protocol = udp
+- thrift_format = compact | binary
+- agent_host = 127.0.0.1
+- agent_port = 6831
+
+The thrift over http has following options
+
+- protocol = http
+- endpoint = http://127.0.0.1:14268
+
+An example of `[tracing]` section
```ini
[tracing]
diff --git a/src/ctrace/src/ctrace_config.erl b/src/ctrace/src/ctrace_config.erl
index bc2a3dff2..c63c77f1b 100644
--- a/src/ctrace/src/ctrace_config.erl
+++ b/src/ctrace/src/ctrace_config.erl
@@ -98,17 +98,37 @@ maybe_start_main_tracer(TracerId) ->
start_main_tracer(TracerId) ->
- Sampler = passage_sampler_all:new(),
- Options = [
- {thrift_format,
- list_to_atom(config:get("tracing", "thrift_format", "compact"))},
- {agent_host, config:get("tracing", "agent_host", "127.0.0.1")},
- {agent_port, config:get_integer("tracing", "agent_port", 6831)},
- {default_service_name,
- list_to_atom(config:get("tracing", "app_name", "couchdb"))}
- ],
+ MaxQueueLen = config:get_integer("tracing", "max_queue_len", 1024),
+ Sampler = jaeger_passage_sampler_queue_limit:new(
+ passage_sampler_all:new(), TracerId, MaxQueueLen),
+ ServiceName = list_to_atom(config:get("tracing", "app_name", "couchdb")),
+
+ ProtocolOptions = case config:get("tracing", "protocol", "udp") of
+ "udp" ->
+ [
+ {thrift_format, list_to_atom(
+ config:get("tracing", "thrift_format", "compact"))},
+ {agent_host,
+ config:get("tracing", "agent_host", "127.0.0.1")},
+ {agent_port,
+ config:get_integer("tracing", "agent_port", 6831)},
+ {protocol, udp},
+ {default_service_name, ServiceName}
+ ];
+ "http" ++ _ ->
+ [
+ {endpoint,
+ config:get("tracing", "endpoint", "http://127.0.0.1:14268")},
+ {protocol, http},
+ {http_client, fun http_client/5},
+ {default_service_name, ServiceName}
+ ]
+ end,
+ Options = [{default_service_name, ServiceName}|ProtocolOptions],
ok = jaeger_passage:start_tracer(TracerId, Sampler, Options).
+http_client(Endpoint, Method, Headers, Body, _ReporterOptions) ->
+ ibrowse:send_req(Endpoint, Headers, Method, Body, []).
compile_filter(OperationId, FilterDef) ->
try