Analysis Type | Status | Details |
---|---|---|
CodeQL Analysis | ✅ Enabled | Daily scans for Go & TypeScript |
Vulnerability Check | ✅ Enabled | Using govulncheck (Go) & OWASP Dependency-Check (TS) |
Code Quality | ✅ Monitored | Regular scans with severity-based alerts |
Security Scanning | 🔒 Active | CVSS 7+ vulnerabilities blocked |
Mirador Explorer is a Grafana app plugin bundled with a dedicated Mirador Core data source. The app delivers Kibana-style log discovery workflows (field stats, AI insights, schema browsing) while the data source handles authenticated access to Mirador Core APIs.
app/
– Mirador Explorer app plugin (custom pages, navigation, UX shell)datasource/
– Mirador Core Connector data source plugindev/
– Engineering docs (action plan, design baselines, testing strategy)architecture-plan.md
– High-level technical blueprint
- Discover workspace with field statistics, histogram interactions, and Lucene builder powered queries.
- Schema Browser surfacing Mirador log fields, metric descriptors, and trace services pulled directly from the datasource backend.
- Mirador Core datasource with authenticated log/metric/trace queries, health checks, and schema resource handlers.
- Live log streaming via WebSocket and comprehensive test harness across Go and TypeScript layers.
- Saved searches, query history, and CSV/JSON exports to accelerate investigation workflows.
- Logs Explorer dashboard panel that deep links Grafana dashboards into the Discover experience.
Sanity/ToDo:
- This repo uses ESLint 8.x and
@grafana/[email protected]
because Grafana's official config does not support ESLint 9.x or flat config as of September 2025. - Attempting to use ESLint 9.x or the flat config will break linting and CI/CD due to missing compatibility in
@grafana/eslint-config
. - We are pinned to 8.x until Grafana releases a compatible config for ESLint 9.x. This is a hard dependency for all plugin code quality and CI workflows.
- TODO: Upgrade to ESLint 9.x and flat config once Grafana releases an official compatible version. Track this in future sprints.
Why:
- Grafana plugin development requires using their official lint config for code style, best practices, and CI/CD compatibility.
- The latest available version (
@grafana/[email protected]
) only supports ESLint 8.x and legacy config format. - This is a known limitation and is documented here for transparency and future upgrades.
- Node.js 22+
- npm 11.5+
- Docker (for local Grafana dev server)
- Grafana ≥12.2.0
- Required for modern UI components
- Needed for React 18 compatibility
- Supports all plugin features and APIs
Component | Minimum Version | Recommended Version |
---|---|---|
Grafana | 12.2.0 | 12.2.0+ |
Node.js | 22.0.0 | 22.0.0+ |
npm | 11.5.1 | 11.5.1+ |
React | 18.2.0 | 18.2.0 |
TypeScript | 5.5.4 | 5.5.4+ |
Option 1: Automated Setup (Recommended)
git clone https://github.com/platformbuilds/miradorstack-grafana-plugin
cd miradorstack-grafana-plugin
# Run the automated setup script
./localdev-up.sh
Option 2: Manual Setup
-
Clone and install dependencies:
git clone https://github.com/platformbuilds/miradorstack-grafana-plugin cd miradorstack-grafana-plugin # Install dependencies for both plugins npm install --prefix app npm install --prefix datasource
-
Build plugins for development:
# Build both plugins (required for Docker mounting) npm run build --prefix app npm run build --prefix datasource
-
Start Grafana with plugins:
# Start Grafana with both plugins mounted docker compose up --build
-
Access Grafana:
- Open http://localhost:3000
- Login with
admin
/admin
- Configure the Mirador Core Connector datasource
- URL: Use
http://host.docker.internal:8080
(Docker provides this alias to reach services on the host)
- URL: Use
- Access Mirador Explorer from the navigation menu
For active development with hot reloading:
-
Start development watchers (in separate terminals):
# Terminal 1: App plugin development npm run dev --prefix app # Terminal 2: Datasource plugin development npm run dev --prefix datasource
-
Start Grafana (in a third terminal):
docker compose up --build
The development watchers will automatically rebuild plugins when you make changes, and Grafana will hot-reload the updated plugins.
# Build app plugin for production
npm run build --prefix app
# Build datasource plugin for production
npm run build --prefix datasource
# Build both plugins
npm run build --prefix app && npm run build --prefix datasource
# Start Grafana with specific version
GRAFANA_VERSION=12.2.0 docker compose up --build
# Start Grafana in detached mode
docker compose up -d --build
# View logs
docker compose logs -f grafana
# Stop Grafana
docker compose down
Under Dashboards → Panels → Logs Explorer Panel, add the Mirador panel to provide one-click navigation into Discover with a preconfigured Lucene query. Panel options let you set the default query and toggle the inline summary; the panel automatically respects the dashboard time range.
If you're deploying Grafana using Helm charts, you can install this plugin by adding it to the plugins list in your values.yaml
:
grafana:
plugins:
- platformbuilds-miradorstack-miradorexplorer-app
- platformbuilds-miradorcoreconnector-datasource
# Optional: If you want to load the plugin from a specific URL
# pluginUrls:
# - https://github.com/platformbuilds/miradorstack-grafana-plugin/releases/download/v1.0.0/miradorstack-miradorexplorer-app-1.0.0.zip
# - https://github.com/platformbuilds/miradorstack-grafana-plugin/releases/download/v1.0.0/miradorstack-miradorcoreconnector-datasource-1.0.0.zip
# Required configuration for the plugin
grafana.ini:
plugins:
allow_loading_unsigned_plugins: "platformbuilds-miradorstack-miradorexplorer-app,platformbuilds-miradorcoreconnector-datasource"
Deploy or upgrade your Grafana installation:
# Add the Grafana Helm repository
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
# Install/upgrade Grafana with the plugin
helm upgrade --install my-grafana grafana/grafana -f values.yaml
After deployment:
- Access your Grafana instance
- Go to Configuration → Plugins to verify the plugin installation
- Configure the Mirador Core Connector data source with your API credentials
- Open Configuration → Mirador Explorer to complete the setup
This project includes comprehensive testing across multiple layers: TypeScript unit tests, Go backend tests, and end-to-end tests.
# Run tests in watch mode (recommended for development)
npm run test --prefix app
# Run tests once (CI mode)
npm run test:ci --prefix app
# Run with coverage
npm run test:ci --prefix app -- --coverage
# Run tests in watch mode (recommended for development)
npm run test --prefix datasource
# Run tests once (CI mode)
npm run test:ci --prefix datasource
# Run with coverage
npm run test:ci --prefix datasource -- --coverage
# Run all Go tests
cd datasource
go test ./...
# Run tests with verbose output
go test -v ./...
# Run tests with coverage
go test -cover ./...
# Lint app plugin
npm run lint --prefix app
# Auto-fix linting issues
npm run lint:fix --prefix app
# Type check app plugin
npm run typecheck --prefix app
# Lint datasource plugin
npm run lint --prefix datasource
# Auto-fix linting issues
npm run lint:fix --prefix datasource
# Type check datasource plugin
npm run typecheck --prefix datasource
# Install Playwright browsers (first time only)
npm run e2e:install --prefix app
# Run E2E tests
npm run e2e --prefix app
# Run E2E tests in headed mode (see browser)
npm run e2e --prefix app -- --headed
# Run specific test
npm run e2e --prefix app -- --grep "test name"
Run the comprehensive smoke test suite that validates the entire datasource plugin:
# Run smoke tests (includes unit tests, type checking, and Go tests)
./dev/tests/smoke.sh
For the best development experience, run tests in watch mode while developing:
# Terminal 1: App tests in watch mode
npm run test --prefix app
# Terminal 2: Datasource tests in watch mode
npm run test --prefix datasource
# Terminal 3: Go tests (rerun manually as needed)
cd datasource && go test ./...
Current test coverage includes:
- TypeScript Unit Tests: 57+ tests covering components, utilities, API clients, and live streaming
- Go Backend Tests: Integration tests for API endpoints and data handling
- E2E Tests: Playwright tests for critical user workflows
- Code Quality: ESLint, TypeScript strict mode, and Go best practices
All tests run automatically on:
- Pull requests
- Pushes to main branch
- Manual workflow dispatch
See dev/testing/strategy.md
for detailed testing strategy and coverage goals.
This repository includes a ready-to-run Docker Compose setup that works on both Intel and Apple Silicon Macs.
-
Prerequisites:
- Docker Desktop installed and running
- Node.js 22+ and npm 11.5+ (for local development)
-
One-time setup:
# Install dependencies npm install --prefix app npm install --prefix datasource # Build plugins (required for Docker mounting) npm run build --prefix app npm run build --prefix datasource
-
Start development environment:
# Start Grafana with plugins docker compose up --build
-
Enable hot reloading (optional, in separate terminals):
# App plugin hot reload npm run dev --prefix app # Datasource plugin hot reload npm run dev --prefix datasource
For a streamlined experience, use the provided automation scripts:
# Automated setup (builds plugins, starts Grafana, verifies setup)
./localdev-up.sh
# Clean shutdown
./localdev-down.sh
# Clean shutdown with Docker resource cleanup
./localdev-down.sh --clean
# Full cleanup including build artifacts
./localdev-down.sh --clean --clean-build --full
This script will:
- Check prerequisites (Node.js, npm, Docker)
- Install plugin dependencies
- Build both plugins
- Start Grafana with Docker Compose
- Wait for Grafana to be ready
- Verify plugin loading
- Display access information and next steps
- The Docker Compose configuration automatically detects and uses the correct platform
- Multi-arch images are pulled automatically
- No additional configuration needed for M1/M2 Macs
- If you encounter issues, ensure Docker Desktop is updated to the latest version
The development container includes:
- Grafana 12.2.0 with plugin support
- Anonymous admin access (
admin
/admin
) - Unsigned plugin loading enabled
- Hot reload support when using
npm run dev
- Persistent storage for Grafana data
- Host gateway access via
host.docker.internal
for connecting to services running on the host machine
# View container logs
docker compose logs -f
# Restart Grafana
docker compose restart
# Clean rebuild
docker compose down
docker compose up --build --force-recreate
# Check plugin loading
docker compose exec grafana grafana-cli plugins ls
# Quick environment management
./localdev-up.sh # Start environment
./localdev-down.sh # Stop environment
./localdev-down.sh --clean # Stop and clean resources
To deploy this plugin in a production Grafana instance:
# Build the app plugin
cd app
npm install
npm run build
# Build the datasource plugin
cd ../datasource
npm install
npm run build
The production-ready plugins will be available in their respective dist/
directories:
app/dist/
- Mirador Explorer app plugindatasource/dist/
- Mirador Core Connector datasource plugin
-
Create the plugins directory in your Grafana instance if it doesn't exist:
mkdir -p /var/lib/grafana/plugins
-
Copy both plugin directories to your Grafana plugins directory:
cp -r app/dist /var/lib/grafana/plugins/platformbuilds-miradorstack-app cp -r datasource/dist /var/lib/grafana/plugins/platformbuilds-miradorstack-datasource
-
Update your Grafana configuration (
grafana.ini
or environment variables) to allow the plugin:[plugins] allow_loading_unsigned_plugins = platformbuilds-miradorstack-app,platformbuilds-miradorstack-datasource
-
Restart Grafana:
systemctl restart grafana-server # For systemd-based systems
- Log into your Grafana instance as an admin
- Go to Configuration → Plugins
- Find and click on "Mirador Core Connector"
- Add a new datasource instance with your Mirador Core API settings
- Go to Configuration → Mirador Explorer
- Configure the app plugin with:
- Mirador Core API URL
- API key
- The UID of your configured Mirador Core Connector datasource
- Check Plugins → Apps to ensure Mirador Explorer is listed and enabled
- Verify the datasource connection test is successful
- Navigate to the Discover page through the app's navigation
- Test a basic log query to confirm end-to-end functionality
- Always use HTTPS for the Mirador Core API connection
- Store API keys securely using Grafana's built-in secrets management
- Review and set appropriate user permissions for the app and datasource access
- Consider using Grafana's role-based access control (RBAC) to manage plugin access