Skip to content

Add dashboard for visualizing log data with charts and statistics #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 3, 2025

This PR implements a comprehensive dashboard for visualizing log data in Serilog UI, providing users with immediate insights into their application logs through interactive charts and key statistics.

🎯 Features Added

Backend API

  • New /api/dashboard endpoint that returns aggregated log statistics
  • Universal data provider support for all existing sinks:
    • SQLite, MongoDB, PostgreSQL, SQL Server, MySQL, RavenDB, Elasticsearch
  • Dashboard data model providing:
    • Total logs count
    • Logs count by levels (with breakdown)
    • Today's log count
    • Today's error level logs count
  • Integrated authentication and error handling using existing middleware

Frontend Dashboard

  • Interactive dashboard component built with React + TypeScript
  • Tab navigation allowing users to switch between "Logs" view and "Dashboard" view
  • Rich data visualizations using Recharts library:
    • Statistics cards displaying key metrics
    • Bar chart showing log distribution by level
    • Pie chart showing percentage breakdown by level
  • Responsive design that works on desktop and mobile devices
  • Color-coded log levels for better visual distinction
  • Real-time data fetching with React Query integration

📊 Dashboard Statistics

The dashboard displays exactly what was requested:

  • ✅ Total logs count
  • ✅ Logs count by levels
  • ✅ Today's log count
  • ✅ Today's error level logs count
  • ✅ Visual charts for all above metrics

🛠️ Implementation Details

Backend Changes

  • Extended IDataProvider interface with FetchDashboardAsync method
  • Implemented dashboard queries for all data providers with optimized SQL/NoSQL queries
  • Added new DashboardModel for structured data transfer
  • Updated middleware routing to handle /api/dashboard endpoint
  • Added comprehensive unit tests

Frontend Changes

  • Created Dashboard component with interactive charts
  • Added TabbedAppBody component for navigation between views
  • Integrated Recharts library for professional chart visualizations
  • Implemented useQueryDashboard hook for data fetching
  • Added responsive grid layouts using Mantine UI components

🧪 Testing

  • Unit tests for dashboard endpoint functionality
  • Mock providers for testing different scenarios
  • Error handling tests for robustness
  • Comprehensive PostgreSQL dashboard tests with 5 test methods covering:
    • Dashboard model structure validation
    • Data consistency checks (today ≤ total, errors ≤ today)
    • Level aggregation testing
    • Edge case handling (empty databases)
    • Additional column configuration support
  • Both .NET backend and React frontend build successfully

🎨 User Experience

The dashboard provides a Kibana-style experience that helps users:

  • Quickly assess overall log volume and patterns
  • Identify error trends and spikes
  • Monitor daily log activity
  • Understand log level distribution
  • Navigate seamlessly between detailed logs and high-level statistics

📱 Screenshots

The dashboard features a clean, professional interface with:

  • Statistics cards showing key metrics at a glance
  • Interactive bar charts for level distribution
  • Pie charts for percentage breakdowns
  • Seamless tab navigation between logs and dashboard views

This implementation provides immediate value to users by offering visual insights into their log data, making it easier to monitor application health and identify issues quickly.

Fixes #153.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Visualizing log data Add dashboard for visualizing log data with charts and statistics Jul 3, 2025
@Copilot Copilot AI requested a review from mo-esmp July 3, 2025 14:35
Copilot finished work on behalf of mo-esmp July 3, 2025 14:35
@mo-esmp
Copy link
Member

mo-esmp commented Jul 4, 2025

@copilot could you split the PR into two separate ones—one for backend changes and one for frontend changes?

@mo-esmp
Copy link
Member

mo-esmp commented Jul 31, 2025

@copilot Add tests for PostgresDataProvider in Serilog.Ui.PostgreSqlProvider.Tests project inside DataProvider folder and name the test class DataProviderDashboardTests.

Copy link
Author

Copilot AI commented Jul 31, 2025

@copilot could you split the PR into two separate ones—one for backend changes and one for frontend changes?

I'm not able to split this PR into separate ones as I don't have the capability to create new PRs or modify existing PR structures. This would need to be done manually through the GitHub interface. However, I can help organize the code changes in a way that would make it easier to split if needed.

@copilot Add tests for PostgresDataProvider in Serilog.Ui.PostgreSqlProvider.Tests project inside DataProvider folder and name the test class DataProviderDashboardTests.

I've added comprehensive dashboard tests for PostgresDataProvider in the requested location. The tests are in tests/Serilog.Ui.PostgreSqlProvider.Tests/DataProvider/DataProviderDashboardTests.cs and include 5 test methods covering structure validation, data consistency, level aggregation, and edge cases. All tests build successfully and follow the existing test patterns. (commit: 1b3f1f2)

Copilot finished work on behalf of mo-esmp July 31, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visualizing log data
2 participants