Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
SigNoz
Commits
26728306
Commit
26728306
authored
2 years ago
by
Srikanth Chekuri
Browse files
Options
Download
Email Patches
Plain Diff
chore: use channel to block until reader init
parent
41e66a73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pkg/query-service/app/clickhouseReader/reader.go
+2
-1
pkg/query-service/app/clickhouseReader/reader.go
pkg/query-service/app/server.go
+3
-1
pkg/query-service/app/server.go
pkg/query-service/pqlEngine/engine.go
+0
-3
pkg/query-service/pqlEngine/engine.go
with
5 additions
and
5 deletions
+5
-5
pkg/query-service/app/clickhouseReader/reader.go
+
2
-
1
View file @
26728306
...
...
@@ -144,7 +144,7 @@ func NewReader(localDB *sqlx.DB, configFile string) *ClickHouseReader {
}
}
func
(
r
*
ClickHouseReader
)
Start
()
{
func
(
r
*
ClickHouseReader
)
Start
(
readerReady
chan
bool
)
{
logLevel
:=
promlog
.
AllowedLevel
{}
logLevel
.
Set
(
"debug"
)
// allowedFormat := promlog.AllowedFormat{}
...
...
@@ -313,6 +313,7 @@ func (r *ClickHouseReader) Start() {
r
.
queryEngine
=
queryEngine
r
.
remoteStorage
=
remoteStorage
r
.
fanoutStorage
=
&
fanoutStorage
readerReady
<-
true
if
err
:=
g
.
Run
();
err
!=
nil
{
level
.
Error
(
logger
)
.
Log
(
"err"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
pkg/query-service/app/server.go
+
3
-
1
View file @
26728306
...
...
@@ -77,18 +77,20 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
}
localDB
.
SetMaxOpenConns
(
10
)
readerReady
:=
make
(
chan
bool
)
var
reader
interfaces
.
Reader
storage
:=
os
.
Getenv
(
"STORAGE"
)
if
storage
==
"clickhouse"
{
zap
.
S
()
.
Info
(
"Using ClickHouse as datastore ..."
)
clickhouseReader
:=
clickhouseReader
.
NewReader
(
localDB
,
serverOptions
.
PromConfigPath
)
go
clickhouseReader
.
Start
()
go
clickhouseReader
.
Start
(
readerReady
)
reader
=
clickhouseReader
}
else
{
return
nil
,
fmt
.
Errorf
(
"Storage type: %s is not supported in query service"
,
storage
)
}
<-
readerReady
rm
,
err
:=
makeRulesManager
(
serverOptions
.
PromConfigPath
,
constants
.
GetAlertManagerApiPrefix
(),
serverOptions
.
RuleRepoURL
,
localDB
,
reader
,
serverOptions
.
DisableRules
)
if
err
!=
nil
{
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
pkg/query-service/pqlEngine/engine.go
+
0
-
3
View file @
26728306
...
...
@@ -32,9 +32,6 @@ func FromConfigPath(promConfigPath string) (*PqlEngine, error) {
}
func
FromReader
(
ch
interfaces
.
Reader
)
(
*
PqlEngine
,
error
)
{
for
ch
.
GetFanoutStorage
()
==
nil
{
time
.
Sleep
(
1
*
time
.
Second
)
}
return
&
PqlEngine
{
engine
:
ch
.
GetQueryEngine
(),
fanoutStorage
:
*
ch
.
GetFanoutStorage
(),
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment