
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@optima-chat/observability
Advanced tools
Optima 生产可观测性共享库 - 专为 Next.js/Node.js 设计
/health 健康检查、/debug/info、/debug/confignpm install @optima/core
# 或
pnpm add @optima/core
// app/api/health/route.ts
import { createHealthHandler } from "@optima/core/diagnostics";
export const GET = createHealthHandler({
serviceName: "agentic-chat",
checks: {
database: async () => {
// 检查数据库连接
return { status: "healthy" };
},
redis: async () => {
// 检查 Redis
return { status: "healthy" };
},
},
});
// app/api/debug/info/route.ts
import { createDebugInfoHandler } from "@optima/core/diagnostics";
export const GET = createDebugInfoHandler();
// app/api/debug/config/route.ts
import { createDebugConfigHandler } from "@optima/core/diagnostics";
export const GET = createDebugConfigHandler();
// app/api/users/route.ts
import { withTracing } from "@optima/core/tracing";
async function handler(request: Request) {
// 处理请求
return Response.json({ users: [] });
}
export const GET = withTracing(handler, {
serviceName: "agentic-chat",
serviceShort: "chat",
});
import { createLogger } from "@optima/core/logging";
const logger = createLogger({
serviceName: "agentic-chat",
format: "json", // 或 "text"
level: "info",
});
logger.info("User logged in", { userId: "123" });
logger.error("Failed to process", { error: "timeout" }, new Error("Timeout"));
import { tracedFetch, createTracedClient } from "@optima/core/http";
// 单次请求
const response = await tracedFetch("http://user-auth/api/users");
// 创建客户端
const authApi = createTracedClient("http://user-auth:8000");
const user = await authApi.get("/users/123");
await authApi.post("/users", { name: "John" });
| 变量 | 说明 | 默认值 |
|---|---|---|
GIT_COMMIT | Git commit hash | unknown |
GIT_BRANCH | Git 分支 | unknown |
APP_VERSION | 应用版本 | 0.0.0 |
BUILD_DATE | 构建日期 | 当前时间 |
DEPLOYMENT_ID | 部署 ID (蓝绿) | - |
LOG_FORMAT | 日志格式 | json |
LOG_LEVEL | 日志级别 | info |
DEBUG_KEY | Debug 端点密钥 | - |
格式: {timestamp_hex}-{random_hex}-{service_short}
示例: 67890abc-f1e2d3c4b5a6-chat
| Header | 说明 |
|---|---|
X-Trace-ID | 追踪 ID |
X-Request-ID | 请求 ID |
X-Response-Time | 响应时间 |
X-Served-By | 服务名-版本 |
X-Deployment-ID | 部署 ID |
MIT
FAQs
Optima 生产可观测性共享库 - 诊断、日志、追踪 (Next.js/Node.js)
We found that @optima-chat/observability demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.