Skip to content

Commit 0cbaa55

Browse files
authored
Fix local ingest body (#88)
1 parent 1eb18d2 commit 0cbaa55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dynatrace_extension/sdk/communication.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,18 @@ def send_metrics(self, mint_lines: list[str]) -> list[MintResponse]:
397397

398398
batches = divide_into_batches(mint_lines, MAX_METRIC_REQUEST_SIZE)
399399
for batch in batches:
400+
lines = json.loads(batch)
400401
if self.local_ingest:
401402
response = request(
402403
"POST",
403404
f"http://localhost:{self.local_ingest_port}/metrics/ingest",
404-
body=batch,
405+
body='\n'.join(lines).encode(),
405406
headers={"Content-Type": CONTENT_TYPE_PLAIN},
406407
).json()
407408
mint_response = MintResponse.from_json(response)
408409
responses.append(mint_response)
409410
elif self.print_metrics:
410-
for line in mint_lines:
411+
for line in lines:
411412
self.logger.info(f"send_metric: {line}")
412413

413414
return responses

0 commit comments

Comments
 (0)