You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have one implementation of get_hostname for Vector itself, and a separate one for the VRL stdlib. It's not a huge deal since they're both quite small and currently the same, but when we introduce changes like allowing hostname to be overridden by an env var we don't want them to get out of sync.
We should de-duplicate those, yes. One way to avoid circular dependencies would be to force VRL to take stubs to anything that performs "external" I/O, such as getting the hostname. We would simply configure it when Vector initializes the VRL runtime, or something to that effect.
This would allow deduplicating without circular dependencies, and could be a potential model to expand upon for exposing "external" I/O through controlled interfaces.
Yeah, I'd be happy with moving it to vector_common for now, and we can provide an actual public API/trait in VRL in the future, when we need VRL to be completely separate from Vector.
Activity
feat(config): allow hostname to be overridden via env var
tobz commentedon Oct 12, 2022
We should de-duplicate those, yes. One way to avoid circular dependencies would be to force VRL to take stubs to anything that performs "external" I/O, such as getting the hostname. We would simply configure it when Vector initializes the VRL runtime, or something to that effect.
This would allow deduplicating without circular dependencies, and could be a potential model to expand upon for exposing "external" I/O through controlled interfaces.
bruceg commentedon Oct 12, 2022
Or just move it to
vector_commontobz commentedon Oct 12, 2022
Perhaps. That's definitely easier in the short term.
lukesteensen commentedon Oct 12, 2022
Good point,
vector_commonis a reasonable short-term fix here. I still don't love that arrangement in general, but that's a different issue.JeanMertz commentedon Oct 13, 2022
Yeah, I'd be happy with moving it to vector_common for now, and we can provide an actual public API/trait in VRL in the future, when we need VRL to be completely separate from Vector.
feat(config): allow hostname to be overridden via env var
Captain1653 commentedon Oct 12, 2026
I looked into this issue to see if the duplication still exists. It seems this has already been resolved in the current codebase.
The centralized implementation resides in
src/lib.rsand properly handles theVECTOR_HOSTNAMEoverride:The implementation in src/sources/exec/mod.rs no longer duplicates any logic — it simply delegates directly to
crate::get_hostname()while converting the Result to an Option:Since the logic is centralized and there is no remaining duplication within Vector, I believe this issue can be safely closed.
pront commentedon Oct 13, 2026
#14819 (comment)