Skip to content

Commit

Permalink
feat(ddtrace): replace static service name with configurable one (INP… (
Browse files Browse the repository at this point in the history
#12)

* feat(ddtrace): replace static service name with configurable one (INP-1571)

* chore(setup): bump the version

Co-authored-by: Ján Porhinčák <[email protected]>
  • Loading branch information
KeNaCo and Ján Porhinčák authored Nov 9, 2021
1 parent cc56b72 commit 095ae01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion request_session/request_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class RequestSession(object):
``requests.Session`` to be used to make the HTTP requests.
:param Ddtrace ddtrace: (optional) DataDog function to be used to trace, track and
send metrics for individual HTTP requests.
:param str ddtrace_service_name: (optional) Service name passed to DataDog DdTrace. Set to "booking_api_requests"
by default.
:param Statsd statsd: (optional) Datadog module to log metrics.
:param SentryClient sentry_client: (optional) Sentry module to log exceptions.
:param Callable logger: (optional) Logger to be used when logging to `stdout`
Expand Down Expand Up @@ -89,6 +91,7 @@ def __init__(
"exception",
"log",
), # type: Tuple
ddtrace_service_name="booking_api_requests", # type: str
):
# type: (...) -> None
self.host = host
Expand All @@ -103,6 +106,7 @@ def __init__(
self.user_agent = user_agent
self.user_agent_components = user_agent_components
self.ddtrace = ddtrace
self.ddtrace_service_name = ddtrace_service_name
self.statsd = statsd
self.sentry_client = sentry_client
self.logger = logger
Expand Down Expand Up @@ -449,7 +453,7 @@ def _send_request(self, request_type, request_params, tags, run, request_categor
if self.ddtrace:
with self.ddtrace.tracer.trace(
"api.request",
service="booking_api_requests",
service=self.ddtrace_service_name,
resource=request_category,
):
response = self.session.request(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="request_session",
version="0.11.0",
version="0.12.0",
url="https://github.com/kiwicom/request-session",
description="Python HTTP requests on steroids",
long_description=readme,
Expand Down

0 comments on commit 095ae01

Please sign in to comment.