Skip to content

Commit

Permalink
Merge pull request #1071 from Kixeye/0.9.x-post
Browse files Browse the repository at this point in the history
Use POST instead of GET for find and render requests (0.9.x)
  • Loading branch information
obfuscurity committed Jan 29, 2015
2 parents 094cf54 + a835a88 commit 4b0706e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions webapp/graphite/local_settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
#REMOTE_STORE_FETCH_TIMEOUT = 6 # Timeout to fetch series data
#REMOTE_STORE_FIND_TIMEOUT = 2.5 # Timeout for metric find requests
#REMOTE_STORE_RETRY_DELAY = 60 # Time before retrying a failed remote webapp
#REMOTE_STORE_USE_POST = False # Use POST instead of GET for remote requests
#REMOTE_FIND_CACHE_DURATION = 300 # Time to cache remote metric find results

## Prefetch cache
Expand Down
10 changes: 8 additions & 2 deletions webapp/graphite/remote_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def send(self):
query_string = urlencode(query_params)

try:
self.connection.request('GET', '/metrics/find/?' + query_string)
if settings.REMOTE_STORE_USE_POST:
self.connection.request('POST', '/metrics/find/', query_string)
else:
self.connection.request('GET', '/metrics/find/?' + query_string)
except:
self.store.fail()
if not self.suppressErrors:
Expand Down Expand Up @@ -132,7 +135,10 @@ def fetch(self, startTime, endTime, now=None, result_queue=None):

connection = HTTPConnectionWithTimeout(self.store.host)
connection.timeout = settings.REMOTE_STORE_FETCH_TIMEOUT
connection.request('GET', '/render/?' + query_string)
if settings.REMOTE_STORE_USE_POST:
self.connection.request('POST', '/render/', query_string)
else:
self.connection.request('GET', '/render/?' + query_string)
response = connection.getresponse()
assert response.status == 200, "Failed to retrieve remote data: %d %s" % (response.status, response.reason)
rawData = response.read()
Expand Down
1 change: 1 addition & 0 deletions webapp/graphite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
REMOTE_STORE_FETCH_TIMEOUT = 6
REMOTE_STORE_FIND_TIMEOUT = 2.5
REMOTE_STORE_RETRY_DELAY = 60
REMOTE_STORE_USE_POST = False
REMOTE_FIND_CACHE_DURATION = 300
REMOTE_PREFETCH_DATA = False

Expand Down

0 comments on commit 4b0706e

Please sign in to comment.