Skip to content

Repository files navigation

log-service

The log-service is a scalable service that queries OpenTelemetry log records gathered from monitored software applications. It provides a REST API for communication with the frontend.

Logs are queried from a ClickHouse database instance, which receives its data from our custom OTel Collector via the ClickHouse exporter. We also employ a custom schema based on the ClickHouse exporter's default schema for logs with some materialized columns for efficient attribute access.

For development instructions, continue reading below. If you just want to run ExplorViz locally, refer to our Deployment repository instead.

Development Instructions

Prerequisites

  • Go 1.25.10 or higher
  • A code editor, such as Visual Studio Code
  • Make sure to run the ExplorViz software stack before starting the service, as it provides the required database(s) and the Collector instance
    • As an alternative, a small Docker compose stack is available in the .dev directory of this repository

Running the service

You can run the service using:

go run . [OPTIONS]

To see a list of command-line options, use the --help flag. These options can also be configured via environment variables, where the name of the environment variable corresponds to the long flag name, prefixed by EXPLORVIZ_ and with all separators replaced by underscores; for example, the --log-level flag corresponds to the EXPLORVIZ_LOG_LEVEL environment variable. Note that directly passing flags takes precedence over environment variables. If neither the flag nor the environment variable is set, then the default value indicated by --help is used.

Debugging Queries

To debug queries against the ClickHouse database, you can use the Web SQL UI, reachable at http://localhost:8123 by default. If you prefer working with a CLI, you can install clickhousectl and connect to the database like this:

chctl local client --host localhost --port 19000

Testing

Be sure to write tests for new code and ensure that existing tests pass. You can run all tests using:

go test ./...

Installing Git hooks

This repository provides Git hooks to verify your code prior to pushing. These can be installed via the included script by running:

go generate ./...

Code Style

As part of our CI/CD pipeline, your code is linted and checked for formatting using golangci-lint, which you can also install locally to lint your code yourself prior to pushing. We recommend using the official Visual Studio Code extension for Go as well as configuring the extension for golangci-lint to detect and fix linting / formatting issues as you're working.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages