Skip to content

Commit

Permalink
Decouple InfluxDB writings from request handling.
Browse files Browse the repository at this point in the history
With #451, we found that writing an InfluxDB data point might block and lead to high latencies.
  • Loading branch information
mpass99 committed Jan 26, 2024
1 parent ae86b1c commit d7f5ba4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/monitoring/influxdb2_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func ChangedPrewarmingPoolSize(id dto.EnvironmentID, count uint) {
func WriteInfluxPoint(p *write.Point) {
if influxClient != nil {
p.AddTag("stage", config.Config.InfluxDB.Stage)
influxClient.WritePoint(p)
// We identified that the influxClient is not truly asynchronous. See #541.
go func() { influxClient.WritePoint(p) }()

Check warning on line 168 in pkg/monitoring/influxdb2_middleware.go

View check run for this annotation

Codecov / codecov/patch

pkg/monitoring/influxdb2_middleware.go#L167-L168

Added lines #L167 - L168 were not covered by tests
} else {
entry := log.WithField("name", p.Name())
for _, tag := range p.TagList() {
Expand Down

0 comments on commit d7f5ba4

Please sign in to comment.