Telescope Documentation

repository·main·Indexed 20 days ago

https://github.com/iamtelescope/telescope

A web-based log viewer UI providing a unified interface for exploring log data across ClickHouse, StarRocks, Docker, and Kubernetes. Features include a Data Explorer with RAW SQL filtering, dynamic visualizations, RBAC with GitHub authentication, and a Django-based backend service.

Tokens
8.5K
Snippets
31
Records
42
Agent score
72%

What's inside Telescope

  1. Overview of Telescope supported data sources

    main

    Telescope is a web-based log viewer UI that provides a unified querying experience across different source types. It supports the following backends:

    • Structured Log Storage: ClickHouse and StarRocks serve as the primary backends for structured data.
    • Cloud-Native & Local Development: Docker (via Docker API) and Kubernetes (via pod logs) provide options for containerized environments.
  2. Configure Authentication and RBAC

    main

    Telescope supports Role-Based Access Control (RBAC) and authentication via GitHub.

    • Authentication: Users can authenticate with GitHub.
    • Organization Enforcement: Administrators can enforce organization membership requirements for access control.
    • Permissions: Access to specific sources is controlled by managing user and group permissions.
  3. Explore and query log data

    main

    The Data Explorer provides tools for analyzing logs through several mechanisms:

    • Visualizations: Use dynamic visualizations and interactive graphs to gain insights.
    • Filtering: Apply filters, select relevant columns, and use a time/date selector (including relative time ranges).
    • Advanced Querying: Execute RAW SQL filtering using WHERE clause expressions compatible with ClickHouse or StarRocks SQL.
    • Graph Grouping: Configure grouping for data, including support for nested fields such as JSON strings, Maps, or Arrays.
  4. Manage data source connections and permissions

    main

    Telescope allows you to manage multiple connections to different data sources. Key management capabilities include:

    • Field Configuration: Define which fields from a source are used, which are suggested, which are hidden, and which support autocompletion.
    • Access Control: Configure which users and groups have access to a specific source and define their specific permissions.
  5. Structure of a UIResponse object

    main

    The UIResponse class is a wrapper for standard UI API responses. It encapsulates the result of an operation, including data, error messages, and validation states.

    When consuming an API response via the SDK, you can expect the following properties:

    • data: An object containing the successful payload.
    • errors: An array of error message strings.
    • messages: An array of success/info message strings.
    • result: A boolean indicating if the operation was successful.
    • aborted: A boolean indicating if the operation was cancelled.
    • validation: An object containing validation details:
      • result: Boolean indicating if validation passed.
      • fields: An object mapping field names to validation errors.
      • non_column: An array of non-field-specific validation errors.
    // Example of the expected shape of a UIResponse instance
    {
      data: {},
      errors: [],
      messages: [],
      result: false,
      aborted: false,
      validation: {
        result: true,
        fields: {},
        non_column: [],
      }
    }
  6. Run the Telescope backend service

    main

    The Telescope backend is a Django application served via Gunicorn. To start the service, you can execute the app.py script directly. This initializes the Django environment using base.settings as the default settings module and applies Gunicorn configurations found in the Telescope configuration object.

    python backend/app.py
  7. Configure the Telescope UI development server

    main

    The Telescope UI uses a Vue CLI-based configuration. When running in development mode, the devServer is configured to proxy API requests to a backend service. By default, it proxies to http://127.0.0.1:8000, but this can be overridden using the VUE_APP_BACKEND_URL environment variable.

    Note that client and webSocketServer are disabled in the default configuration, and historyApiFallback is enabled to support single-page application (SPA) routing.

    // The devServer configuration uses the following proxy logic:
    proxy: process.env.VUE_APP_BACKEND_URL || 'http://127.0.0.1:8000'
  8. Configure Gunicorn via Telescope configuration

    main
    The TelescopeApp class (which inherits from gunicorn.app.base.BaseApplication) automatically loads Gunicorn settings from the Telescope configuration. Any key-value pairs located under the gunicorn section in your configuration will be applied to the Gunicorn server instance via self.cfg.set(key, value) during the load_config phase.
  9. Format timestamps as absolute date-time strings

    main

    Use getDateTimeString(input, timeZone) to convert a millisecond timestamp into a human-readable string. The output follows the format yyyy-MM-dd HH:mm:ss.SSS.

    // Example usage
    const timestamp = 1672531200000;
    const formatted = getDateTimeString(timestamp, 'UTC');
    // Returns something like '2023-01-01 00:00:00.000'
  10. Retrieve Telescope frontend configuration via ConfigView

    main

    The ConfigView provides an API endpoint to fetch the configuration required by the Telescope frontend. It returns a dictionary containing the values defined under settings.CONFIG['frontend']. This endpoint is protected and requires authentication.

    # GET /path-to-config-view/
    # Returns a JSON response containing:
    # settings.CONFIG.get("frontend", {})