Netflix Atlas Documentation

repository·main·Indexed 25 days ago

https://github.com/netflix/atlas

A backend system for managing dimensional time series data, enabling the storage and querying of metrics with complex dimensions. Includes documentation for the Atlas expression evaluation library, Atlas LSP for editor integration (supporting completions, semantic tokens, and diagnostics), the LWC API for managing expression subscriptions and streams, and chart graphics utilities for rendering time-series data.

Tokens
8.6K
Snippets
14
Records
54
Agent score
86%

What's inside Netflix Atlas

  1. Integrate Atlas LSP with an Editor

    main

    The Atlas LSP server communicates via standard JSON-RPC. To integrate it with an editor (like VS Code or Neovim), follow these steps:

    1. Build the LSP server JAR file.
    2. Launch the JAR using stdin/stdout as the transport mechanism.
    3. Configure your editor's LSP client to connect to the process.
  2. Initialize the Evaluator manually

    main

    To use the Atlas expression evaluation library without an injector, you can manually instantiate the Evaluator class. This requires a Config object, a Registry, and an Akka ActorSystem.

    Config config = ConfigFactory.load();
    Registry registry = new DefaultRegistry();
    ActorSystem system = ActorSystem.create("eval", config);
    Evaluator evaluator = new Evaluator(config, registry, system);
  3. Discover and Merge Glossary Files

    main

    The Atlas LSP discovers and merges glossary files from two sources:

    1. Classpath: Files matching atlas/glossary/*.json under META-INF/. Libraries can ship fragments by placing them at META-INF/atlas/glossary/<id>.json within their JAR.
    2. Configuration: An optional list of file paths or URLs provided in the application configuration under atlas.lsp.glossary.files.

    Merge Rules

    • Metrics: Merged by metric name. Fields are merged, with later fragments winning on conflict. tags sub-objects are deep-merged.
    • Tag keys: Merged by tag key name. Later fragments override earlier ones. values arrays are unioned (deduplicated).
    • Tag values: Merged by compound key (tagKey=tagValue). Later descriptions override earlier ones.
    • Duplicate IDs: If two fragments share the same id, the LSP logs a warning and uses the last one loaded.
    # Example HOCON configuration
    atlas.lsp.glossary.files = [
      "/path/to/team-glossary.json"
    ]
  4. Run the Atlas LSP Test Client

    main

    To test the Atlas LSP server using the browser-based Monaco Editor client, follow these steps:

    1. Start the LSP server using SBT:
      project/sbt 'atlas-lsp/test:runMain com.netflix.atlas.lsp.AslLspRunner'
    2. In a separate terminal, set up and start the test client:
      cd atlas-lsp/test-client
      npm install
      npm run dev
    3. Open the URL provided by Vite (e.g., http://localhost:5173) in your browser.
    project/sbt 'atlas-lsp/test:runMain com.netflix.atlas.lsp.AslLspRunner'
    
    cd atlas-lsp/test-client
    npm install
    npm run dev
  5. Define an Atlas Glossary file

    main

    An Atlas glossary file is a JSON object used to describe metrics, tag keys, and tag values within a domain. The Atlas LSP uses these files to provide completions, hover documentation, and validation for query expressions. Glossary files are composable and can be merged from multiple sources.

    Top-level keys in a glossary JSON object:

    • id (string, required): A unique identifier for the fragment (e.g., "common-tags").
    • description (string, optional): A human-readable description.
    • metrics (object, optional): Metric definitions keyed by metric name.
    • tagKeys (object, optional): Global tag key definitions keyed by tag key name.
    • tagValues (object, optional): Documentation for specific tag values keyed by "tagKey=tagValue".
  6. Run the standalone Atlas server

    main

    The standalone Atlas server can be started by executing the JAR file and providing configuration files as command-line arguments. If no arguments are provided, the application defaults to loading static.conf.

    When providing arguments, the application attempts to load them as files. If a specified path does not exist as a file, it attempts to load the configuration from the classpath resources using ConfigFactory.parseResourcesAnySyntax.

    $ java -jar atlas.jar config1.conf config2.conf
  7. Connect Monaco Editor to Atlas LSP via WebSocket

    main

    If you are building a custom integration using Monaco Editor, you can connect to the Atlas LSP server using the built-in MonacoLspClient and WebSocketTransport.

    const ws = new WebSocket('ws://localhost:7102');
    const transport = monaco.lsp.WebSocketTransport.fromWebSocket(ws);
    new monaco.lsp.MonacoLspClient(transport);
  8. Create a Single URI Publisher

    main

    You can create a Reactive Streams Publisher<TimeSeriesMessage> from an Atlas graph URI using evaluator.createPublisher(uri). This publisher can be consumed by any Reactive Streams implementation.

    String uri = "http://localhost:7101/api/v1/graph?q=name,ssCpuUser,:eq,:avg";
    Publisher<TimeSeriesMessage> publisher = evaluator.createPublisher(uri);