mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-09-13 10:03:16 +08:00
fix(query-service): skip preloading non-json files under dashboards (#6979)
### 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>
This commit is contained in:
parent
bbf64a7b52
commit
c6fda99b9b
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -23,6 +24,10 @@ func readCurrentDir(dir string, fm interfaces.FeatureLookup) error {
|
||||
|
||||
list, _ := file.Readdirnames(0) // 0 to read all files and folders
|
||||
for _, filename := range list {
|
||||
if strings.ToLower(filepath.Ext(filename)) != ".json" {
|
||||
zap.L().Debug("Skipping non-json file", zap.String("filename", filename))
|
||||
continue
|
||||
}
|
||||
zap.L().Info("Provisioning dashboard: ", zap.String("filename", filename))
|
||||
|
||||
// using filepath.Join for platform specific path creation
|
||||
|
Loading…
x
Reference in New Issue
Block a user