diff options
author | Tony Sun <tony.sun427@gmail.com> | 2021-04-13 11:12:55 -0700 |
---|---|---|
committer | Tony Sun <tony.sun427@gmail.com> | 2021-04-13 11:18:11 -0700 |
commit | b1f1d1c05b34de949e42fa74c76d654a3f225adb (patch) | |
tree | 0e05fa27a5d148de028cd07bd1032f0378a20244 | |
parent | f754fadb92e7d42a3fa25777953b3657f5b70649 (diff) | |
download | couchdb-prometheus-endpoint.tar.gz |
add license to missing filesprometheus-endpoint
-rw-r--r-- | rel/overlay/etc/default.ini | 2 | ||||
-rw-r--r-- | src/couch_prometheus/src/couch_prometheus_http.erl | 15 | ||||
-rw-r--r-- | src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index 5bdaef389..dded4a973 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -909,4 +909,4 @@ compaction = false [prometheus] additional_port = true bind_address = 127.0.0.1 -port = {{prometheus_port}}
\ No newline at end of file +port = {{prometheus_port}} diff --git a/src/couch_prometheus/src/couch_prometheus_http.erl b/src/couch_prometheus/src/couch_prometheus_http.erl index c123a3892..bd0c4c6f9 100644 --- a/src/couch_prometheus/src/couch_prometheus_http.erl +++ b/src/couch_prometheus/src/couch_prometheus_http.erl @@ -1,3 +1,15 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + -module(couch_prometheus_http). -compile(tuple_calls). @@ -35,7 +47,8 @@ start_link() -> handle_request(MochiReq) -> RawUri = MochiReq:get(raw_path), {"/" ++ Path, _, _} = mochiweb_util:urlsplit_path(RawUri), - PathParts = string:tokens(Path, "/"), try + PathParts = string:tokens(Path, "/"), + try case PathParts of ["_node", Node, "_prometheus"] -> send_prometheus(MochiReq, Node); diff --git a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl index 4bfbdd940..c862b9a9f 100644 --- a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl +++ b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl @@ -124,11 +124,6 @@ create_db(Url) -> Addr = config:get("chttpd", "bind_address", "127.0.0.1"), Port = mochiweb_socket_server:get(chttpd, port), {ok, Status, _, _} = test_request:put(Url, [?CONTENT_JSON, ?AUTH], "{}"), - case Status of - 201 -> ok; - 202 -> ok; - _ -> io:format(user, "~n HTTP Status Code: ~p~n", [Status]) - end, ?assert(Status =:= 201 orelse Status =:= 202). delete_db(Url) -> |