Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Track HTTP compression in telemetry

Patryk Zawadzkifcc284a15e27
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c1120218f..590be08758 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Added support for the `BrokerProperties` custom header to webhooks to support Azure Service Bus - #15899 by @patrys
- Extend valid address values - #15877 by @zedzior
- Fixed a rare crash in the introspection query detection code - #15966 by @patrys
+- Added HTTP compression telemetry - #16125 by @patrys
# 3.19.0
diff --git a/saleor/graphql/views.py b/saleor/graphql/views.py
index 1d16b0941d..cc5b0b14e5 100644
--- a/saleor/graphql/views.py
+++ b/saleor/graphql/views.py
@@ -166,6 +166,10 @@ class GraphQLView(View):
opentracing.tags.HTTP_URL,
request.build_absolute_uri(request.get_full_path()),
)
+ accepted_encoding = request.META.get("HTTP_ACCEPT_ENCODING", "")
+ span.set_tag(
+ "http.compression", "gzip" if "gzip" in accepted_encoding else "none"
+ )
span.set_tag("http.useragent", request.META.get("HTTP_USER_AGENT", ""))
span.set_tag("span.type", "web")