Initial commit: 000-platform project skeleton
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
46
sdk/__init__.py
Normal file
46
sdk/__init__.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Platform SDK - 平台基础设施客户端SDK
|
||||
|
||||
提供统一的统计上报、日志记录、链路追踪等功能。
|
||||
|
||||
使用示例:
|
||||
from platform import get_logger, StatsClient, LoggingMiddleware
|
||||
|
||||
# 日志
|
||||
logger = get_logger("my-app")
|
||||
logger.info("Hello")
|
||||
|
||||
# 统计
|
||||
stats = StatsClient(tenant_id=1, app_code="my-app")
|
||||
stats.report_ai_call(...)
|
||||
|
||||
# FastAPI中间件
|
||||
app.add_middleware(LoggingMiddleware)
|
||||
"""
|
||||
|
||||
from .logger import get_logger, PlatformLogger
|
||||
from .stats_client import StatsClient
|
||||
from .trace import TraceContext, get_trace_id, generate_trace_id
|
||||
from .middleware import LoggingMiddleware, TraceMiddleware
|
||||
from .http_client import PlatformHttpClient
|
||||
from .config_reader import ConfigReader
|
||||
|
||||
__version__ = "0.1.0"
|
||||
|
||||
__all__ = [
|
||||
# Logger
|
||||
"get_logger",
|
||||
"PlatformLogger",
|
||||
# Stats
|
||||
"StatsClient",
|
||||
# Trace
|
||||
"TraceContext",
|
||||
"get_trace_id",
|
||||
"generate_trace_id",
|
||||
# Middleware
|
||||
"LoggingMiddleware",
|
||||
"TraceMiddleware",
|
||||
# HTTP
|
||||
"PlatformHttpClient",
|
||||
# Config
|
||||
"ConfigReader",
|
||||
]
|
||||
Reference in New Issue
Block a user