Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

write_to_textfile leaves back temp files on errors #1044

Copy link
Copy link
Closed
@calestyo

Description

@calestyo
Issue body actions

Hey.

A simple:

prometheus_client.write_to_textfile("", registry=registry)

which causes an exception:

Traceback (most recent call last):
  File "/home/calestyo/prj/prometheus-smart-array-collector/src/./smart-array.py", line 1185, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/calestyo/prj/prometheus-smart-array-collector/src/./smart-array.py", line 1176, in main
    prometheus_client.write_to_textfile("", registry=registry)
  File "/usr/lib/python3/dist-packages/prometheus_client/exposition.py", line 363, in write_to_textfile
    os.rename(tmppath, path)
FileNotFoundError: [Errno 2] No such file or directory: '.969277.139657657282624' -> ''

shows that the module doesn't properly clean up it's temp files on errors, as that file is left over afterwards.

Cheers,
Chris.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.