Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

don't issue requests that don't apply to query nodes, and if they do receive them, don't crash #1295

Merged
merged 7 commits into from
Apr 26, 2019

Conversation

Dieterbe
Copy link
Contributor

@Dieterbe Dieterbe commented Apr 25, 2019

fix #1293
tested with docker-cluster-query

curl -v -s -i http://localhost:6061/metrics/delete -d "query=foo.bar.*"
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 6061 (#0)
> POST /metrics/delete HTTP/1.1
> Host: localhost:6061
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 15
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 15 out of 15 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json
Content-Type: application/json
< Date: Thu, 25 Apr 2019 19:19:15 GMT
Date: Thu, 25 Apr 2019 19:19:15 GMT
< Server: Caddy
Server: Caddy
< Trace-Id: 77f0002c62c7ce6a
Trace-Id: 77f0002c62c7ce6a
< Vary: Accept-Encoding
Vary: Accept-Encoding
< Content-Length: 17
Content-Length: 17

< 
* Connection #0 to host localhost left intact
{"deletedDefs":0}* Closing connection 0
metrictank-q0_1  | [Macaron] 2019-04-25 19:19:15: Started POST /metrics/delete for 172.19.0.1
metrictank2_1    | [Macaron] 2019-04-25 19:19:15: Started POST /index/delete for 172.19.0.15
metrictank0_1    | [Macaron] 2019-04-25 19:19:15: Started POST /index/delete for 172.19.0.15
metrictank1_1    | [Macaron] 2019-04-25 19:19:15: Started POST /index/delete for 172.19.0.15
metrictank3_1    | [Macaron] 2019-04-25 19:19:15: Started POST /index/delete for 172.19.0.15
metrictank0_1    | [Macaron] 2019-04-25 19:19:15: Completed /index/delete 200 OK in 595.024µs
metrictank3_1    | [Macaron] 2019-04-25 19:19:15: Completed /index/delete 200 OK in 843.7µs
metrictank1_1    | [Macaron] 2019-04-25 19:19:15: Completed /index/delete 200 OK in 480.244µs
metrictank-q0_1  | [Macaron] 2019-04-25 19:19:15: Completed /metrics/delete 200 OK in 2.436699ms
metrictank2_1    | [Macaron] 2019-04-25 19:19:15: Completed /index/delete 200 OK in 753.214µs
curl -v -s -i http://localhost:6061/metrics/delete -d "query=some.id.of.a.metric.1*"
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 6061 (#0)
> POST /metrics/delete HTTP/1.1
> Host: localhost:6061
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 28
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 28 out of 28 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json
Content-Type: application/json
< Date: Thu, 25 Apr 2019 19:20:18 GMT
Date: Thu, 25 Apr 2019 19:20:18 GMT
< Server: Caddy
Server: Caddy
< Trace-Id: 372447439ff27ee9
Trace-Id: 372447439ff27ee9
< Vary: Accept-Encoding
Vary: Accept-Encoding
< Content-Length: 19
Content-Length: 19

< 
* Connection #0 to host localhost left intact
{"deletedDefs":224}* Closing connection 0
metrictank-q0_1  | [Macaron] 2019-04-25 19:20:18: Started POST /metrics/delete for 172.19.0.1
metrictank3_1    | [Macaron] 2019-04-25 19:20:18: Started POST /index/delete for 172.19.0.15
metrictank0_1    | [Macaron] 2019-04-25 19:20:18: Started POST /index/delete for 172.19.0.15
metrictank2_1    | [Macaron] 2019-04-25 19:20:18: Started POST /index/delete for 172.19.0.15
metrictank1_1    | [Macaron] 2019-04-25 19:20:18: Started POST /index/delete for 172.19.0.15
metrictank1_1    | [Macaron] 2019-04-25 19:20:18: Completed /index/delete 200 OK in 36.641483ms
metrictank3_1    | [Macaron] 2019-04-25 19:20:18: Completed /index/delete 200 OK in 45.013004ms
metrictank2_1    | [Macaron] 2019-04-25 19:20:18: Completed /index/delete 200 OK in 47.188199ms
metrictank0_1    | [Macaron] 2019-04-25 19:20:18: Completed /index/delete 200 OK in 49.311407ms
metrictank-q0_1  | [Macaron] 2019-04-25 19:20:18: Completed /metrics/delete 200 OK in 51.236528ms

@Dieterbe Dieterbe requested review from replay and woodsaj April 25, 2019 19:25
@robert-milan robert-milan self-requested a review April 26, 2019 10:53
Copy link
Contributor

@robert-milan robert-milan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, aside from typo and broken unit tests.

@Dieterbe Dieterbe merged commit dd9b92d into master Apr 26, 2019
@Dieterbe Dieterbe deleted the issue-1293 branch April 26, 2019 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/metrics/delete on query nodes: nilpointer in api.(*Server).metricsDeleteLocal
4 participants