Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: return 404 for invalid URL's for consistency
Browse files Browse the repository at this point in the history
URL's that are invalid should return a 404, just like any other
invalid URL.

Closes #578
  • Loading branch information
bbangert committed Aug 19, 2016
1 parent 8fed768 commit 9ecd6b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ after_success:
notifications:
slack:
secure: LE+1Nelh5PLrb35LU6yJI1EV2LDVm4V90Tb+5LhUpeGrcfqr47HhMLMGXbBSnnjYPRLCiT75xog+oMN5eAF4VnZle4qza6Ue7G+YwRtGo/V0ud0i2zSUT557yXcr2QCYAzTKJVgetnxQNYvru/l1trdNZsRbsPUm1vexAjaX5yo=
addons:
hostname: push.mozilla.com

5 changes: 3 additions & 2 deletions autopush/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ def timing(self, name, duration, **kwargs):
class DatadogMetrics(object):
"""DataDog Metric backend"""
def __init__(self, api_key, app_key, flush_interval=10,
namespace="autopush"):
namespace="autopush", hostname="localhost"):

datadog.initialize(api_key=api_key, app_key=app_key)
datadog.initialize(api_key=api_key, app_key=app_key,
host_name=hostname)
self._client = ThreadStats()
self._flush_interval = flush_interval
self._host = get_hostname()
Expand Down
24 changes: 13 additions & 11 deletions autopush/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,6 @@ def __init__(self,
pool = HTTPConnectionPool(reactor)
self.agent = Agent(reactor, connectTimeout=5, pool=pool)

# Metrics setup
if datadog_api_key:
self.metrics = DatadogMetrics(
api_key=datadog_api_key,
app_key=datadog_app_key,
flush_interval=datadog_flush_interval
)
elif statsd_host:
self.metrics = TwistedMetrics(statsd_host, statsd_port)
else:
self.metrics = SinkMetrics()
if not crypto_key:
crypto_key = [Fernet.generate_key()]
if not isinstance(crypto_key, list):
Expand All @@ -133,6 +122,19 @@ def __init__(self,
if resolve_hostname:
self.hostname = resolve_ip(self.hostname)

# Metrics setup
if datadog_api_key:
self.metrics = DatadogMetrics(
api_key=datadog_api_key,
app_key=datadog_app_key,
flush_interval=datadog_flush_interval,
hostname=self.hostname,
)
elif statsd_host:
self.metrics = TwistedMetrics(statsd_host, statsd_port)
else:
self.metrics = SinkMetrics()

self.port = port
self.endpoint_hostname = endpoint_hostname or self.hostname
self.router_hostname = router_hostname or self.hostname
Expand Down

0 comments on commit 9ecd6b0

Please sign in to comment.