Skip to content

Commit

Permalink
Fix static mode file tailing race condition (#5317)
Browse files Browse the repository at this point in the history
* Upgrade loki dependency to k169

* Fix tests after removal of stream_lag_labels
  • Loading branch information
thampiotr authored Sep 28, 2023
1 parent 66c4b92 commit 548259e
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 25 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Main (unreleased)
- Fixed the `agent_prometheus_scrape_targets_gauge` incorrectly reporting all discovered targets
instead of targets that belong to current instance when clustering is enabled. (@thampiotr)

- Fixed race condition in cleaning up metrics when stopping to tail files in static mode. (@thampiotr)

### Other changes

- Use Go 1.21.1 for builds. (@rfratto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ func toLokiWriteArguments(config *client.Config, diags *diag.Diagnostics) *lokiw
)
}

// Also deprecated in promtail.
if len(config.StreamLagLabels) != 0 {
diags.Add(
diag.SeverityLevelWarn,
"stream_lag_labels is deprecated and the associated metric has been removed",
)
}

return &lokiwrite.Arguments{
Endpoints: []lokiwrite.EndpointOptions{
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(Error) global positions configuration is not supported - each Flow Mode's loki.source.file component has its own positions file in the component's data directory
(Warning) stream_lag_labels is deprecated and the associated metric has been removed
(Error) Promtail's WAL is currently not supported in Flow Mode
(Error) limits_config is not yet supported in Flow Mode
(Warning) If you have a tracing set up for Promtail, it cannot be migrated to Flow Mode automatically. Refer to the documentation on how to configure tracing in Flow Mode.
Expand All @@ -8,5 +7,4 @@
(Warning) The Agent's Flow Mode metrics are different from the metrics emitted by Promtail. If you rely on Promtail's metrics, you must change your configuration, for example, your alerts and dashboards.
(Warning) server.log_level is not supported - Flow mode components may produce different logs
(Error) server.http_path_prefix is not supported
(Warning) server.health_check_target disabling is not supported in Flow mode
(Warning) stream_lag_labels is deprecated and the associated metric has been removed
(Warning) server.health_check_target disabling is not supported in Flow mode
3 changes: 0 additions & 3 deletions converter/internal/promtailconvert/testdata/unsupported.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ global:
clients:
- url: http://localhost/loki/api/v1/push
drop_rate_limited_batches: true
stream_lag_labels: hare,tortoise
positions:
filename: /dev/urandom
options:
stream_lag_labels: hare,tortoise
wal:
enabled: true
limits_config:
Expand Down
8 changes: 0 additions & 8 deletions converter/internal/promtailconvert/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ func validateTopLevelConfig(cfg *promtailcfg.Config, diags *diag.Diagnostics) {
)
}

// The global and per-client stream lag labels is deprecated and has no effect.
if len(cfg.Options.StreamLagLabels) > 0 {
diags.Add(
diag.SeverityLevelWarn,
"stream_lag_labels is deprecated and the associated metric has been removed",
)
}

// WAL support is still work in progress and not documented. Enabling it won't work, so it's an error.
if cfg.WAL.Enabled {
diags.Add(
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2
github.com/grafana/dskit v0.0.0-20230829141140-06955c011ffd
github.com/grafana/go-gelf/v2 v2.0.1
github.com/grafana/loki v1.6.2-0.20230904153656-e4cc2a4f5ec8 // k166 branch
github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183 // k169 branch
github.com/grafana/pyroscope-go/godeltaprof v0.1.3
github.com/grafana/pyroscope/api v0.2.0
github.com/grafana/pyroscope/ebpf v0.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1587,8 +1587,8 @@ github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD
github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85/go.mod h1:crI9WX6p0IhrqB+DqIUHulRW853PaNFf7o4UprV//3I=
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 h1:WB3bGH2f1UN6jkd6uAEWfHB8OD7dKJ0v2Oo6SNfhpfQ=
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU=
github.com/grafana/loki v1.6.2-0.20230904153656-e4cc2a4f5ec8 h1:ER13f09dUfAbAN+zQdKgUdRSrvUC97G3OX2y6/qrtII=
github.com/grafana/loki v1.6.2-0.20230904153656-e4cc2a4f5ec8/go.mod h1:qqOYLjJ9m92TqjWO5IOsEm6B7AodORoc9IZUC5Q4Caw=
github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183 h1:klVM7g0Tl31QSd9dvypCe5XAQ49AM+acGAH2DwXdllA=
github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183/go.mod h1:hiGUcnMCZ86m122rzu8xySnRiGDQ8TzPowVmCvWZAJ4=
github.com/grafana/loki/pkg/push v0.0.0-20230904153656-e4cc2a4f5ec8 h1:yQK/dX7WBva5QvITvmIcbv4boLwSo65a8zjuZcucnko=
github.com/grafana/loki/pkg/push v0.0.0-20230904153656-e4cc2a4f5ec8/go.mod h1:5ll3An1wAxYejo6aM04+3/lc6N4joYVYLY5U+Z4O6vI=
github.com/grafana/mysqld_exporter v0.12.2-0.20201015182516-5ac885b2d38a h1:D5NSR64/6xMXnSFD9y1m1DPYIcBcHvtfeuI9/M/0qtI=
Expand Down

0 comments on commit 548259e

Please sign in to comment.