Skip to content

grafana/docs-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Grafana Learning Journeys Plugin

Dynamic JSON Badge License

A documentation plugin that provides contextual learning journeys directly within the Grafana interface.

Overview

The Grafana Learning Journeys Plugin transforms how users interact with documentation by providing:

  • 🎯 Context-Aware Recommendations - suggestions based on current Grafana context (page, data sources, dashboard state)
  • πŸ“š Interactive Learning Journeys - Step-by-step guided experiences with progress tracking and milestone navigation
  • πŸ—‚οΈ Tabbed Interface - Browser-like multi-tab experience for simultaneous documentation access
  • πŸ”Œ Extensible Architecture - Decoupled design allowing easy integration with different content sources
  • πŸ“± Responsive Design - Optimized for sidebar integration with adaptive layouts
  • πŸš€ Auto-Launch Tutorials - Automatically open specific tutorials on Grafana startup for demo scenarios

Architecture

For a comprehensive overview of the plugin's architecture, design patterns, and system organization, see ARCHITECTURE.md.

Running the plugin locally

Clone the repository:

git clone https://github.com/grafana/docs-plugin.git

Then build the plugin:

cd docs-plugin
npm install
npm run build

Spin up the development server:

Note we are currently using main until the next release of Grafana.

npm run server

Access the plugin in Grafana at http://localhost:3000

Developer Documentation

This plugin follows a modular, well-documented architecture. Each major component has detailed documentation:

πŸ“ Core Architecture

🧩 Components

πŸ”§ System Architecture

🎨 Assets

Development Setup

Prerequisites

  • Node.js 18+ and npm
  • Grafana 11.0.0 or later
  • Git
  • Docker (for development environment)

Quick Start

# Clone the repository
git clone https://github.com/grafana/grafana-docs-plugin.git
cd grafana-docs-plugin

# Install dependencies
npm install

# Build the plugin
npm run build

# Start development environment with Grafana
GRAFANA_IMAGE=jayclifford349/grafana-oss GRAFANA_VERSION=docs npm run server

Development Environment

The plugin includes a complete development setup:

# Development build with watch mode
npm run dev

# Run tests
npm run test

# Lint code
npm run lint

# Type checking
npm run typecheck

# Build for production
npm run build

Project Structure Deep Dive

For a comprehensive understanding of the project structure, see:

Key Technologies

  • βš›οΈ React - UI framework with hooks and context
  • 🎭 Grafana Scenes - Scene-based architecture for complex UIs
  • πŸ“˜ TypeScript - Full type safety and IntelliSense
  • πŸ’… Emotion - CSS-in-JS with theme integration
  • 🎨 Grafana UI - Consistent component library
  • πŸ”— Extension Points - Grafana plugin integration system

Configuration Options

API Integration

// Configure external recommendation service
export const RECOMMENDER_SERVICE_URL = 'http://localhost:8080';

// Custom documentation endpoints
const customEndpoints = {
  apiUrl: 'https://docs.company.com/api',
  apiKey: 'your-secret-key'
};

For detailed configuration options, see the App Configuration README.

API Reference

Core Classes

For detailed API documentation, see:

Troubleshooting

Common Issues

Content Loading Problems

// Debug content fetching
console.log('Fetching strategies attempted:', strategies);
console.log('Final content result:', content);

// Check network connectivity
fetch(url).then(response => console.log('Direct access:', response.status));

Recommendation Service Issues

// Verify service connectivity
const healthCheck = await fetch(`${RECOMMENDER_SERVICE_URL}/health`);
console.log('Recommender service status:', healthCheck.status);

// Debug context payload
console.log('Context sent to recommender:', payload);

Cache Issues

// Clear all caches manually
clearLearningJourneyCache();
localStorage.clear();
window.location.reload();

Performance Optimization

Bundle Size Analysis

# Analyze bundle composition
npm run build:analyze

# Check for duplicate dependencies
npm run dedupe

Content Loading Optimization

// Implement progressive loading
const preloadNextMilestone = async (content: LearningJourneyContent) => {
  const nextUrl = getNextMilestoneUrl(content);
  if (nextUrl) {
    // Pre-fetch in background
    fetchLearningJourneyContent(nextUrl);
  }
};

For more troubleshooting information, see the component-specific documentation linked above.

Debugging Tips

Enable Verbose Logging

// Add to console for detailed logging
localStorage.setItem('docs-plugin-debug', 'true');

// Monitor scene state changes
console.log('Scene state:', sceneObject.state);

Network Request Debugging

// Monitor all fetch requests
const originalFetch = window.fetch;
window.fetch = (...args) => {
  console.log('Fetch request:', args);
  return originalFetch(...args);
};

Contributing

Code Style

  • TypeScript: Strict mode enabled
  • React: Functional components with hooks
  • Styling: Emotion CSS-in-JS with Grafana theme
  • Testing: Jest + React Testing Library

Submission Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Test your changes thoroughly
  4. Commit with conventional commit messages
  5. Push to your branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Development Workflow

# 1. Set up development environment
npm install
npm run dev

# 2. Make changes and test
npm run test
npm run typecheck
npm run lint

# 3. Build and verify
npm run build
npm run server # Test in Grafana

# 4. Submit changes
git add .
git commit -m "feat: add custom content source support"
git push origin feature/custom-content

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Quick Links

About

A documentation plugin that provides contextual learning journeys directly within the Grafana interface.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

Languages