Skip to content

Commit

Permalink
update loki sender
Browse files Browse the repository at this point in the history
  • Loading branch information
SoprachevAK committed Mar 17, 2024
1 parent 10c34ad commit 71af8c9
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,20 @@ def send(self, level, msg):
self.logs_queue.append(Message(level, msg))

def _sending_loop(self):
BigWorld.callback(5, self._sending_loop)
BigWorld.callback(10, self._sending_loop)

try:
if len(self.logs_queue) == 0: return

defaultStreamLabels = {
"source": "mod",
"region": _get_region(),
"modVersion": _get_mod_version(),
}

defaultStreamMeta = {
"service": "mod",
"playerName": _get_player_name(),
"region": _get_region(),
"gameVersion": _get_game_version(),
"modVersion": _get_mod_version(),
"session": self.session_id
}

Expand All @@ -141,8 +144,8 @@ def _sending_loop(self):
if len(current) == 0: continue

streams.append({
"stream": dict(defaultStreamMeta, level=level),
"values": map(lambda l: [str(l.time), l.message], current)
"stream": dict(defaultStreamLabels, level=level),
"values": map(lambda l: [str(l.time), l.message, defaultStreamMeta], current)
})

data = {"streams": streams}
Expand Down

0 comments on commit 71af8c9

Please sign in to comment.