Compare commits
2 Commits
8766813858
...
e441a22fc8
| Author | SHA1 | Date | |
|---|---|---|---|
| e441a22fc8 | |||
| 4822b83069 |
@@ -30,8 +30,6 @@ def write_event(event, game: str) -> bool:
|
|||||||
try:
|
try:
|
||||||
p = Point(event.type).time(event.time * 1_000_000_000)
|
p = Point(event.type).time(event.time * 1_000_000_000)
|
||||||
p.tag("game", game)
|
p.tag("game", game)
|
||||||
p.tag("serverId", event.serverId)
|
|
||||||
# Ensure data is a dict, even if not provided
|
|
||||||
for k, v in (event.data or {}).items():
|
for k, v in (event.data or {}).items():
|
||||||
if isinstance(v, (int, float, str, bool)):
|
if isinstance(v, (int, float, str, bool)):
|
||||||
p.field(k, v)
|
p.field(k, v)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from fastapi.responses import JSONResponse, FileResponse
|
|||||||
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||||||
from .auth import init_db, verify_api_key, get_db
|
from .auth import init_db, verify_api_key, get_db
|
||||||
from .models import Event, BatchEvents
|
from .models import Event, BatchEvents
|
||||||
from .influx import write_event, client, INFLUX_ORG, INFLUX_BUCKET
|
from .influx import write_ev3t, client, INFLUX_ORG, INFLUX_BUCKET
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from typing import Any, List, Optional
|
|||||||
class Event(BaseModel):
|
class Event(BaseModel):
|
||||||
type: str
|
type: str
|
||||||
time: int
|
time: int
|
||||||
serverId: str
|
|
||||||
data: Optional[dict] = {}
|
data: Optional[dict] = {}
|
||||||
|
|
||||||
class BatchEvents(BaseModel):
|
class BatchEvents(BaseModel):
|
||||||
|
|||||||
Reference in New Issue
Block a user