@cozeloop/observation-pages
Observability and tracing pages for CozeLoop platform, providing comprehensive trace monitoring, analysis, and debugging capabilities.
Overview
This package provides the observability system pages for the CozeLoop platform. It offers trace monitoring and analysis capabilities, allowing users to track, search, and debug application execution flows. The package integrates with the CozeLoop observation infrastructure to provide detailed insights into span execution, performance metrics, and trace data.
Getting Started
Installation
Add this package to your package.json:
{
"dependencies": {
"@cozeloop/observation-pages": "workspace:*"
}
}Then run:
rush updateUsage
import ObservationApp from '@cozeloop/observation-pages';
import { BrowserRouter } from 'react-router-dom';
function App() {
return (
);
}The app provides comprehensive trace monitoring and analysis with automatic routing configuration.
Features
Trace Monitoring
- Trace List View: Browse and search all traces with advanced filtering
- Trace Detail Panel: Deep dive into individual trace execution flows
- Span Analysis: Examine individual spans with detailed metrics
- Real-time Search: Search traces by various criteria including trace ID, status, and custom fields
- Performance Metrics: Track latency, tokens, and other performance indicators
- Multi-language Support: Internationalization with Chinese and English locales
Key Capabilities
Advanced Filtering: Filter traces by platform type, date range, status, and custom fields
Column Customization: Configure visible columns including:
- Status and trace/span identifiers
- Input/output data
- Token usage (input, output, total)
- Latency metrics (total and first response)
- Timestamps and metadata
- Prompt keys and span information
Trace Details: View comprehensive trace information including:
- Span hierarchy and relationships
- Advanced trace information
- Input/output data for each span
- Performance metrics and timing data
Custom Views: User-configurable views with customizable columns and filters
Routes
The application provides the following routes:
/- Redirects to traces page/traces- Main trace monitoring and analysis page
API Reference
Default Export
The package exports a single React component that provides the complete observation application with built-in routing.
import ObservationApp from '@cozeloop/observation-pages';Features Integration
The observation pages integrate with:
- Trace List Component:
CozeloopTraceListWithDetailPanelfrom@cozeloop/observation-components - Field Metadata: Dynamic field metadata fetching based on platform and span types
- API Integration: Direct integration with
observabilityTraceAPI for data fetching - User Context: Integration with workspace and user information
Configurable Columns
The following columns are available for trace viewing:
status- Trace execution statustrace_id- Unique trace identifierspan_id- Span identifierspan_type- Type of spanspan_name- Name of the spaninput- Input dataoutput- Output datatokens- Total token countinput_tokens- Input token countoutput_tokens- Output token countlatency- Total latencylatency_first_resp- First response latencystart_time- Execution start timeprompt_key- Associated prompt keylogic_delete_date- Logical deletion date
Dependencies
This package integrates with:
@cozeloop/observation-components: Core observation UI components and utilities@cozeloop/api-schema: API type definitions and observation schemas@cozeloop/i18n-adapter: Internationalization support@cozeloop/components: Shared UI components (PrimaryPage, etc.)@cozeloop/biz-hooks-adapter: Business logic hooks (workspace, user info)@cozeloop/guard: Access control and permissions@coze-arch/coze-design: UI component libraryreact-router-dom: Routing functionality
Development
This package is built with:
- TypeScript for type safety
- React 18+ for UI components
- React Router for navigation
- Vitest for testing
- ESLint for code quality
- Coze Design System for UI components
Scripts
# Build the package
npm run build
# Run linting
npm run lint
# Run tests
npm run test
# Run tests with coverage
npm run test:cov