From 4d89a420a798d17b56f4adb6e1e81b9e4e966396 Mon Sep 17 00:00:00 2001 From: Doug Wright Date: Fri, 24 Jan 2025 11:34:15 -0800 Subject: [PATCH] Fix issue with utm_source not appearing in generated insight links Closes https://github.com/stacklok/codegate/issues/765 --- src/codegate/pipeline/extract_snippets/output.py | 3 ++- src/codegate/utils/utils.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/codegate/pipeline/extract_snippets/output.py b/src/codegate/pipeline/extract_snippets/output.py index a9b7adae..53b3af24 100644 --- a/src/codegate/pipeline/extract_snippets/output.py +++ b/src/codegate/pipeline/extract_snippets/output.py @@ -72,7 +72,8 @@ async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext) lib_type = lib["properties"]["type"] lib_status = lib["properties"]["status"] lib_url = ( - f"https://www.insight.stacklok.com/report/{lib_type}/{quote(lib_name, safe='')}" + f"https://www.insight.stacklok.com/report/{lib_type}/" + f"{quote(lib_name, safe='')}?utm_source=codegate" ) warnings.append( diff --git a/src/codegate/utils/utils.py b/src/codegate/utils/utils.py index 6096e051..d0be0edd 100644 --- a/src/codegate/utils/utils.py +++ b/src/codegate/utils/utils.py @@ -19,7 +19,10 @@ def generate_vector_string(package) -> str: } vector_str += f" is a {type_map.get(package['type'], 'package of unknown type')}. " package_name = quote(package["name"], safe="") - package_url = f"https://www.insight.stacklok.com/report/{package['type']}/{package_name}" + package_url = ( + f"https://www.insight.stacklok.com/report/{package['type']}/" + f"{package_name}?utm_source=codegate" + ) # Add extra status status_suffix = status_messages.get(package["status"], "")