signoz/pkg/query-service
Vikrant Gupta 26fe5e49e7
chore: revamp the frontend architecture (#6598)
* feat: setup the app context to fetch users,licenses and feature flags

* feat: added global event listeners for after_login event

* feat: remove redux from app state and private route

* feat: syncronize the approutes file

* feat: cleanup the private routes

* feat: handle login and logout

* feat: cleanup the app layout file

* feat: cleanup and syncronize side nav item

* fix: minor small re-render issue

* feat: parallel processing for sync calls for faster bootup of application

* feat: some refactoring for private routes

* fix: entire application too much re-rendering

* fix: remove redux

* feat: some more corrections

* feat: fix all the files except signup

* feat: add app provider to the test-utils

* feat: should fix a lot of tests

* chore: fix more tests

* chore: fix more tests

* feat: fix some tests and corrected the redux mock

* feat: delete snapshot

* fix: test cases

* fix: pipeline actions test cases

* fix: billing test cases

* feat: update the signup API to accept isAnonymous and hasOptedUpdates

* chore: cleanup the console logs

* fix: indefinite loading on manage licenses screen

* fix: better handling and route to something_went_wrong in case of qs down

* fix: signup for subsequent users

* chore: update test-utils

* fix: jerky behaviour on entering the home page

* feat: handle the retention for login context flow

* fix: do not let users workaround workspace blocked screen
2024-12-20 14:00:02 +05:30
..
2024-12-19 12:01:12 +00:00
2024-09-24 10:22:52 +05:30
2024-05-15 18:52:01 +05:30
2021-01-03 18:15:44 +05:30
2024-12-19 12:01:12 +00:00
2021-09-02 13:18:47 +05:30
2024-11-22 12:00:29 +05:30

Query Service

Query service is the interface between frontend and databases. It is written in Golang. It will have modules for all supported databases. Query service is responsible to:

  • parse the request from Frontend
  • create relevant Clickhouse queries (and all other supported database queries)
  • parse response from databases and handle error if any
  • clickhouse response in the format accepted by Frontend

Complete the clickhouse setup locally.

https://github.com/SigNoz/signoz/blob/main/CONTRIBUTING.md#to-run-clickhouse-setup-recommended-for-local-development

  • Comment out the query-service and the frontend section in signoz/deploy/docker/clickhouse-setup/docker-compose.yaml
  • Change the alertmanager section in signoz/deploy/docker/clickhouse-setup/docker-compose.yaml as follows:
alertmanager:
    image: signoz/alertmanager:0.23.7
    volumes:
      - ./data/alertmanager:/data
    expose:
      - "9093"
    ports:
      - "8080:9093"
    # depends_on:
    #   query-service:
    #     condition: service_healthy
    restart: on-failure
    command:
      - --queryService.url=http://172.17.0.1:8085
      - --storage.path=/data
  • Run the following:
cd signoz/
If you are using x86_64 processors (All Intel/AMD processors) run sudo make run-x86
If you are on arm64 processors (Apple M1 Macs) run sudo make run-arm

Backend Configuration

  • Open ./constants/constants.go

    • Replace const RELATIONAL_DATASOURCE_PATH = "/var/lib/signoz/signoz.db"
      with const RELATIONAL_DATASOURCE_PATH = "./signoz.db".
  • Query Service needs below env variables to run:

    export ClickHouseUrl=tcp://localhost:9001
    export STORAGE=clickhouse
    export ALERTMANAGER_API_PREFIX=http://localhost:9093/api/

Build and Run locally

cd pkg/query-service
go build -o build/query-service main.go
ClickHouseUrl=tcp://localhost:9001 STORAGE=clickhouse build/query-service --prefer-delta=true 

Frontend Configuration for local query-service.

  • Set the following environment variables
export FRONTEND_API_ENDPOINT=http://localhost:8080
  • Run the following
cd signoz\frontend\
yarn install
yarn dev

Note:

If you use go version 1.18 for development and contributions, then please checkout the following issue. https://github.com/SigNoz/signoz/issues/1371

Docker Images

The docker images of query-service is available at https://hub.docker.com/r/signoz/query-service