-
Notifications
You must be signed in to change notification settings - Fork 658
add max length configuration for service_name and instance_name #609
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
Conversation
if (properties.containsKey(lengthKey)) { | ||
lengthLimited = Math.max(lengthLimited, Integer.valueOf(properties.getProperty(lengthKey, "0"))); | ||
} |
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.
I think max
would be a little tricky. As we provided a configuration item, I would prefer to use the configuration value to override static codes as always.
Could you explain why do you code as max
?
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.
The default value is 50, which means it is the suggested value. If the configuration is smaller than it which means most of the service names or instance names will be cut especially in k8s environment.
So we suggest the configuration for the length is better bigger than the default value.
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.
You are adding a feature to provide customization, I can't see why bigger is acceptable, but smaller isn't.
Your explanation seems doesn't make sense.
All length relative configurations are accepting value length in both ways.
Please update the codes to provide an override capability, rather than within this condition.
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.
ok, I will change code to prefer user's configuration.
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.
@wu-sheng done
int lengthLimited = lengthDefine.value(); | ||
String lengthKey = String.format("%s#length", configKey); | ||
if (properties.containsKey(lengthKey)) { | ||
lengthLimited = Integer.valueOf(properties.getProperty(lengthKey, "0")); |
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.
I think we are better to try catch the Integer#valueOf
and system.err
if type cast fails. WDYT?
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.
LGTM. Thanks for the patient
CHANGES
log.