Skip to content

Commit

Permalink
lint: Black Code Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Italo Santos committed Mar 27, 2021
1 parent 59f3289 commit ef6b7b0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
12 changes: 10 additions & 2 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def get_metric_config():
get_1h_metrics = getenv("SENTRY_ISSUES_1H") or default_for_time_metrics
get_24h_metrics = getenv("SENTRY_ISSUES_24H") or default_for_time_metrics
get_14d_metrics = getenv("SENTRY_ISSUES_14D") or default_for_time_metrics
return [scrape_issue_metrics, scrape_events_metrics, get_1h_metrics, get_24h_metrics, get_14d_metrics]
return [
scrape_issue_metrics,
scrape_events_metrics,
get_1h_metrics,
get_24h_metrics,
get_14d_metrics,
]


@app.route("/")
Expand All @@ -52,7 +58,9 @@ def sentry_exporter():
sentry = SentryAPI(BASE_URL, AUTH_TOKEN)
log.info("exporter: cleaning registry collectors...")
clean_registry()
REGISTRY.register(SentryCollector(sentry, ORG_SLUG, get_metric_config(), PROJECTS_SLUG))
REGISTRY.register(
SentryCollector(sentry, ORG_SLUG, get_metric_config(), PROJECTS_SLUG)
)
exporter = DispatcherMiddleware(app.wsgi_app, {"/metrics": make_wsgi_app()})
return exporter

Expand Down
10 changes: 8 additions & 2 deletions helpers/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ class SentryCollector(object):
>>> REGISTRY.register(SentryCollector(sentry, org_slug, projects_slug))
"""

def __init__(self, sentry_api, sentry_org_slug, metric_scraping_config, sentry_projects_slug=None):
def __init__(
self,
sentry_api,
sentry_org_slug,
metric_scraping_config,
sentry_projects_slug=None,
):
"""Inits SentryCollector with a SentryAPI object"""
super(SentryCollector, self).__init__()
self.__sentry_api = sentry_api
Expand Down Expand Up @@ -175,7 +181,7 @@ def __build_sentry_data_from_api(self):
self.org.get("slug"), project, env, age="14d"
)

log.debug("data structure: building projects issues data"):
log.debug("data structure: building projects issues data")
for k, v in project_issues_1h.items():
projects_issue_data[project.get("slug")][k] = {"1h": v}

Expand Down
5 changes: 4 additions & 1 deletion libs/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ def issues(self, org_slug, project, environment=None, age="24h"):
raise TypeError("project param isn't a dictionary")

issues_url = "projects/{org}/{proj_slug}/issues/?project={proj_id}&sort=date&query=age%3A-{age}".format(
org=org_slug, proj_slug=project.get("slug"), proj_id=project.get("id"), age=age
org=org_slug,
proj_slug=project.get("slug"),
proj_id=project.get("id"),
age=age,
)

if environment:
Expand Down

0 comments on commit ef6b7b0

Please sign in to comment.