-
Notifications
You must be signed in to change notification settings - Fork 15
controller: write config agent version info to ClickHouse #3578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -584,8 +584,8 @@ func (c *Controller) Run(ctx context.Context) error { | |
| }() | ||
|
|
||
| if c.clickhouse != nil { | ||
| if err := c.clickhouse.CreateTable(ctx); err != nil { | ||
| c.log.Warn("error creating clickhouse table, continuing without clickhouse", "error", err) | ||
| if err := c.clickhouse.CreateTables(ctx); err != nil { | ||
| c.log.Warn("error creating clickhouse tables, continuing without clickhouse", "error", err) | ||
| c.clickhouse = nil | ||
| } else { | ||
| go c.clickhouse.Run(ctx) | ||
|
|
@@ -824,6 +824,13 @@ func (c *Controller) GetConfig(ctx context.Context, req *pb.ConfigRequest) (*pb. | |
| Timestamp: reqStart, | ||
| DevicePubkey: req.GetPubkey(), | ||
| }) | ||
| c.clickhouse.RecordVersion(versionEvent{ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Write amplification: |
||
| DevicePubkey: req.GetPubkey(), | ||
| UpdatedAt: reqStart, | ||
| AgentVersion: agentVersion, | ||
| AgentCommit: agentCommit, | ||
| AgentDate: agentDate, | ||
| }) | ||
| } | ||
| return resp, nil | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flushVersionsnever resetsconsecutiveErrors = 0on success, unlikeflushEvents(line 192). Both paths share the counter that drives WARN→ERROR escalation. Common case is masked becauseflushEventsruns first and resets, but if the events flush errors early (e.g. PrepareBatch failure) while versions succeed, the counter stays elevated though writes are flowing. Reads as a copy-paste omission. Fix: reset here on success, or reset once inflush()after both sub-flushes succeed.