Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse committed Oct 29, 2024
1 parent 96b7951 commit ff83bb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ddapm_test_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ async def _apmtelemetry_by_session(self, token: Optional[str]) -> List[Telemetry
events: List[TelemetryEvent] = []
for req in self._requests_by_session(token):
if req.match_info.handler == self.handle_v2_apmtelemetry:
events.append(v2_apmtelemetry_decode(await req.read()))
events.append(await v2_apmtelemetry_decode_request(req, await req.read()))

# TODO: Sort the events?
return events
Expand Down
8 changes: 5 additions & 3 deletions ddapm_test_agent/apmtelemetry.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import asyncio
import json
import logging
from aiohttp.web import Request
from typing import Any
from typing import Dict
from typing import cast

log = logging.getLogger(__name__)
from aiohttp.web import Request


log = logging.getLogger(__name__)
TelemetryEvent = Dict[str, Any]


async def v2_decode_request(request: Request, data: bytes) -> TelemetryEvent:
headers = request.headers

Expand All @@ -20,7 +22,7 @@ async def v2_decode_request(request: Request, data: bytes) -> TelemetryEvent:
if duration > 0:
log.info("Stalling for %r seconds.", duration)
await asyncio.sleep(duration)
v2_decode(data)
return v2_decode(data)


def v2_decode(data: bytes) -> TelemetryEvent:
Expand Down

0 comments on commit ff83bb9

Please sign in to comment.