Skip to content

prometheus: remove stale unix socket file when binding from ffi - #48432

Merged
jkarneges merged 2 commits into
mainfrom
jkarneges/prom-rm-before-bind
Sep 14, 2026
Merged

jkarneges merged 2 commits into
mainfrom
jkarneges/prom-rm-before-bind

Conversation

@jkarneges

@jkarneges jkarneges commented Sep 14, 2026

Copy link
Copy Markdown
Member

When binding a unix socket, the specified file must not exist. We already have logic to handle this in NetListener::bind_config (i.e. delete stale file before binding), we just need to be using it. This PR refactors the prometheus_server_create FFI function to call bind_config.

@jkarneges
jkarneges requested a lite review from Copilot September 14, 2026 16:47
@jkarneges
jkarneges force-pushed the jkarneges/prom-rm-before-bind branch from f69a6b6 to 6459971 Compare September 14, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Refactors the Prometheus FFI server creation to reuse existing NetListener::bind_config logic so stale Unix socket files are removed before binding.

Changes:

  • Replace custom FFI listen-address parsing with NetListenConfig + NetListener::bind_config.
  • Add NetListenConfig::from_prometheus_port_str helper for parsing the Prometheus listen format (ipc://…, host:port, or port).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/core/prometheus.rs Refactors FFI server creation to parse into NetListenConfig and bind via bind_config (stale unix socket cleanup).
src/core/config.rs Adds a parsing helper to build NetListenConfig from the Prometheus port/address string format.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/core/prometheus.rs Outdated
Comment thread src/core/config.rs
Comment thread src/core/config.rs Outdated
@jkarneges
jkarneges force-pushed the jkarneges/prom-rm-before-bind branch from 6459971 to a8731f5 Compare September 14, 2026 18:49
@jkarneges
jkarneges requested a review from a team September 14, 2026 19:09
@jkarneges
jkarneges merged commit cf2e144 into main Sep 14, 2026
21 checks passed
@jkarneges
jkarneges deleted the jkarneges/prom-rm-before-bind branch September 14, 2026 20:25
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.

3 participants