mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-29 16:42:04 +08:00

### Summary - query-service: skip preloading non-json files under dashboards Resolves the error log: ``` {"level":"INFO","timestamp":"2025-01-29T17:37:18.635Z","caller":"dashboards/provision.go:26","msg":"Provisioning dashboard: ","filename":".gitkeep"} {"level":"ERROR","timestamp":"2025-01-29T17:37:18.635Z","caller":"dashboards/provision.go:38","msg":"Creating Dashboards: Error in unmarshalling json from file","filename":".gitkeep","error":"unexpected end of JSON input","stacktrace":"go.signoz.io/signoz/pkg/query-service/app/dashboards.readCurrentDir\n\t/home/sa_100696978840572610735/signoz/pkg/query-service/app/dashboards/provision.go:38\ngo.signoz.io/signoz/pkg/query-service/app/dashboards.LoadDashboardFiles\n\t/home/sa_100696978840572610735/signoz/pkg/query-service/app/dashboards/provision.go:79\ngo.signoz.io/signoz/pkg/query-service/app.NewAPIHandler\n\t/home/sa_100696978840572610735/signoz/pkg/query-service/app/http_handler.go:271\ngo.signoz.io/signoz/ee/query-service/app/api.NewAPIHandler\n\t/home/sa_100696978840572610735/signoz/ee/query-service/app/api/api.go:56\ngo.signoz.io/signoz/ee/query-service/app.NewServer\n\t/home/sa_100696978840572610735/signoz/ee/query-service/app/server.go:287\nmain.main\n\t/home/sa_100696978840572610735/signoz/ee/query-service/main.go:191\nruntime.main\n\t/home/sa_100696978840572610735/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.7.linux-amd64/src/runtime/proc.go:271"} ``` Signed-off-by: Prashant Shahi <prashant@signoz.io>
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.
- Comment out the query-service and the frontend section in
signoz/deploy/docker/docker-compose.yaml
- Change the alertmanager section in
signoz/deploy/docker/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 deploy/docker
docker compose up -d
Backend Configuration
-
Open ./constants/constants.go
- Replace
const RELATIONAL_DATASOURCE_PATH = "/var/lib/signoz/signoz.db"
withconst RELATIONAL_DATASOURCE_PATH = "./signoz.db".
- Replace
-
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