-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feature(enterprise): configurable app name #18554
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
99c53bb
feature(enterprise): configurable service name
dsmith3197 a105d7d
cleanup & vector -> Vector
dsmith3197 9625858
nit
dsmith3197 39b9c7b
nit
dsmith3197 94decfe
cleanup
dsmith3197 2f2f4e7
switch order
dsmith3197 aad4c20
add sluggification for dd-evp-origin
dsmith3197 20c1b08
fmt
dsmith3197 0a69f0e
feedback & fix vector-enterprise
dsmith3197 2cc23ac
nits
dsmith3197 fad4306
add expect entry
dsmith3197 798fcca
correctly set app name for user agent as well
dsmith3197 b9b5543
fix error
dsmith3197 698f525
oncelock
dsmith3197 790a97a
fmt again
dsmith3197 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -984,6 +984,7 @@ skywalking | |
slashin | ||
slf | ||
slideover | ||
slugified | ||
smallvec | ||
smartphone | ||
Smol | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,6 +124,38 @@ pub use source_sender::SourceSender; | |
pub use vector_common::{shutdown, Error, Result}; | ||
pub use vector_core::{event, metrics, schema, tcp, tls}; | ||
|
||
static APP_NAME_SLUG: std::sync::OnceLock<String> = std::sync::OnceLock::new(); | ||
|
||
/// Flag denoting whether or not enterprise features are enabled. | ||
#[cfg(feature = "enterprise")] | ||
pub static ENTERPRISE_ENABLED: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); | ||
|
||
/// The name used to identify this Vector application. | ||
/// | ||
/// This can be set at compile-time through the VECTOR_APP_NAME env variable. | ||
/// Defaults to "Vector". | ||
pub fn get_app_name() -> &'static str { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 I can see this coming in handy in other places too in the future. |
||
#[cfg(not(feature = "enterprise"))] | ||
let app_name = "Vector"; | ||
#[cfg(feature = "enterprise")] | ||
let app_name = if *ENTERPRISE_ENABLED.get().unwrap_or(&false) { | ||
"Vector Enterprise" | ||
} else { | ||
"Vector" | ||
}; | ||
|
||
option_env!("VECTOR_APP_NAME").unwrap_or(app_name) | ||
} | ||
|
||
/// Returns a slugified version of the name used to identify this Vector application. | ||
|
||
/// | ||
/// Defaults to "vector". | ||
pub fn get_slugified_app_name() -> String { | ||
APP_NAME_SLUG | ||
.get_or_init(|| get_app_name().to_lowercase().replace(' ', "-")) | ||
.clone() | ||
} | ||
|
||
/// The current version of Vector in simplified format. | ||
/// `<version-number>-nightly`. | ||
pub fn vector_version() -> impl std::fmt::Display { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍