feat: Add TelemetryService schema and service

The code changes introduce the `TelemetryService` schema and service in the `langflow.services.telemetry` module. This addition enables the application to collect and analyze telemetry data.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-23 01:10:23 -03:00
commit 35f2e62385
2 changed files with 42 additions and 35 deletions

View file

@ -0,0 +1,35 @@
from pydantic import BaseModel
class RunPayload(BaseModel):
IsWebhook: bool = False
seconds: int
success: bool
errorMessage: str = ""
class ShutdownPayload(BaseModel):
timeRunning: int
class VersionPayload(BaseModel):
version: str
platform: str
python: str
arch: str
autoLogin: bool
cacheType: str
backendOnly: bool
class PlaygroundPayload(BaseModel):
seconds: int
componentCount: int
success: bool
class ComponentPayload(BaseModel):
name: str
seconds: int
success: bool
errorMessage: str

View file

@ -9,47 +9,19 @@ from loguru import logger
from pydantic import BaseModel
from langflow.services.base import Service
from langflow.services.telemetry.schema import (
ComponentPayload,
PlaygroundPayload,
RunPayload,
ShutdownPayload,
VersionPayload,
)
from langflow.utils.version import get_version_info
if TYPE_CHECKING:
from langflow.services.settings.service import SettingsService
class RunPayload(BaseModel):
isEndpointName: str
IsWebhook: bool
seconds: int
success: bool
errorMessage: str
class ShutdownPayload(BaseModel):
timeRunning: int
class VersionPayload(BaseModel):
version: str
platform: str
python: str
arch: str
autoLogin: bool
cacheType: str
backendOnly: bool
class PlaygroundPayload(BaseModel):
seconds: int
componentCount: int
success: bool
class ComponentPayload(BaseModel):
name: str
seconds: int
success: bool
errorMessage: str
class TelemetryService(Service):
name = "telemetry_service"