Skip to content

Commit 760dedd

Browse files
Fix a bug with sending metrics
1 parent 8dfd23d commit 760dedd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

datadog_sync/utils/configuration.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,21 @@ async def init_async(self, cmd: Command):
9696
else:
9797
self.logger.warning("DDR verification skipped.")
9898

99-
await self.source_client.send_metric(f"{cmd.value}.start")
100-
await self.destination_client.send_metric(f"{cmd.value}.start")
99+
if cmd in [Command.IMPORT] and self.send_metrics:
100+
await self.source_client.send_metric(f"{cmd.value}.start")
101+
try:
102+
await self.destination_client.send_metric(f"{cmd.value}.start")
103+
except Exception:
104+
self.logger.info("Optional destination not defined")
105+
if cmd in [Command.SYNC, Command.RESET] and self.send_metrics:
106+
await self.destination_client.send_metric(f"{cmd.value}.start")
107+
try:
108+
await self.source_client.send_metric(f"{cmd.value}.start")
109+
except Exception:
110+
self.logger.info("Optional source not defined")
111+
if cmd in [Command.MIGRATE] and self.send_metrics:
112+
await self.source_client.send_metric(f"{cmd.value}.start")
113+
await self.destination_client.send_metric(f"{cmd.value}.start")
101114

102115
async def exit_async(self):
103116
await self.source_client._end_session()

0 commit comments

Comments
 (0)