Skip to content

Conversation

elmerzeng
Copy link
Contributor

@elmerzeng elmerzeng commented Sep 14, 2023

@wu-sheng wu-sheng added this to the 9.1.0 milestone Sep 14, 2023
Comment on lines 91 to 93
if (properties.containsKey(lengthKey)) {
lengthLimited = Math.max(lengthLimited, Integer.valueOf(properties.getProperty(lengthKey, "0")));
}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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"));
Copy link
Member

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?

Copy link
Member

@wu-sheng wu-sheng left a 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

@wu-sheng wu-sheng merged commit e6f12b5 into apache:main Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants