Skip to content

Commit

Permalink
clean up PR
Browse files Browse the repository at this point in the history
  • Loading branch information
wconti27 committed Oct 6, 2023
1 parent 5277612 commit 59994f2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ddapm_test_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def __init__(self):
"/telemetry/proxy/api/v2/apmtelemetry",
"/v0.1/pipeline_stats",
]
self._sent_integrations: set = set()

async def traces(self) -> TraceMap:
"""Return the traces stored by the agent in the order in which they
Expand Down Expand Up @@ -405,7 +404,7 @@ async def _integration_requests_by_session(
integration_name=integration_name,
integration_version=integration_version,
dependency_name=data.get("dependency_name", integration_name),
version_sent=f"{integration_name}:{integration_version}" in self._sent_integrations,
version_sent=f"{integration_name}@{integration_version}" in ",".join(os.listdir("artifacts")),
)
req["tracer_version"] = data.get("tracer_version", None)
req["tracer_language"] = data.get("tracer_language", None)
Expand All @@ -426,7 +425,7 @@ async def _integration_requests_by_session(
integration_name=integration_name,
integration_version=integration_version,
dependency_name=req["_dd_trace_env_variables"].get("DD_DEPENDENCY_NAME", integration_name),
version_sent=f"{integration_name}:{integration_version}" in self._sent_integrations,
version_sent=f"{integration_name}@{integration_version}" in ",".join(os.listdir("artifacts")),
)

if req.headers.get("dd-client-library-version", None):
Expand Down Expand Up @@ -540,13 +539,13 @@ async def update_seen_integration_versions(self):
)
# update the actual req to store that the integration / version have been emitted so we can skip the req later
integration.version_sent = True
# add hash of integration name and version so that later similar requests are not emitted
self._sent_integrations.add(f"{integration.integration_name}:{integration.integration_version}")

async def save_tested_integrations(self, integration: Integration, tracer_language: str, tracer_version: str):
headers = ["language_name", "tracer_version", "integration_name", "integration_version", "dependency_name"]
log.debug(f"Saving Integration: {integration.integration_name} to current directory")
filename = f"./artifacts/{integration.integration_name}_supported_versions.csv"
filename = (
f"./artifacts/{integration.integration_name}@{integration.integration_version}_supported_versions.csv"
)

# create test artifact directory if it doesnt exist
directory = "./artifacts"
Expand Down Expand Up @@ -587,7 +586,7 @@ async def handle_get_tested_integrations(self, request: Request) -> web.Response
if lines[0] == ",".join(headers) + "\n":
lines = lines[1:] # Skip the headers if they already exist in the file
aggregated_text += "".join(lines)
headers = {"file-name": file}
headers = {"file-name": file.split("@")[0]} # use integration name before @ as filename
return web.Response(body=aggregated_text, content_type="text/plain", headers=headers)

async def handle_info(self, request: Request) -> web.Response:
Expand Down

0 comments on commit 59994f2

Please sign in to comment.