Skip to content
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

Perform atomic writes for resulting service discovery YAML file #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

neilramsay
Copy link

Perform atomic writes for resulting service discovery YAML file

We were seeing parsing error messages in Prometheus, as below:

ts=2022-02-08T17:59:59.920Z caller=file.go:337 level=error component="discovery manager scrape" discovery=file msg="Error reading file" path=/etc/prometheus/prometheus_ecs_container_endpoints.123456789.yml err="yaml: line 186: could not find expected ':'"

On manual inspection of the files, they appeared complete and could be parsed.
This indicates that the file is not complete at the time Prometheus is reading it.

The https://github.com/natefinch/atomic library allows writing the service discovery file,
and then atomically moving it in place.

Neil Ramsay added 3 commits February 9, 2022 12:34
We were seeing parsing error messages in Prometheus, as below:
```
ts=2022-02-08T17:59:59.920Z caller=file.go:337 level=error component="discovery manager scrape" discovery=file msg="Error reading file" path=/etc/prometheus/prometheus_ecs_container_endpoints.123456789.yml err="yaml: line 186: could not find expected ':'"
```
On manual inspection of the files, they appeared complete and could be parsed.
This indicates that the file is not complete at the time Prometheus is reading it.

The https://github.com/natefinch/atomic library allows writing the service discovery file,
and then atomically moving it in place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant