Skip to content
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

config-file part degradation #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yueyuetangg
Copy link

What type of PR is this?

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yueyuetangg

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

README.md Outdated
{
"degradation": {
"enabled": true,
"percentage": 0

Choose a reason for hiding this comment

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

Setting percentage as 0 is kinda weird when degradation is enabled.
It's a good idea to make the documentation more uniform, see config-etcd, etc.

README.md Outdated
},
"degradation": {
"enabled": true,
"percentage": 0

Choose a reason for hiding this comment

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

ditto.

README_CN.md Outdated
{
"degradation": {
"enabled": true,
"percentage": 0

Choose a reason for hiding this comment

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

ditto.

README_CN.md Outdated
},
"degradation": {
"enabled": true,
"percentage": 0

Choose a reason for hiding this comment

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

ditto.


// EqualsTo returns true if the current Config equals to the other Config
func (c *DegradationConfig) EqualsTo(other iface.ConfigValueItem) bool {
o := other.(*DegradationConfig)

Choose a reason for hiding this comment

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

Had better check whether c == nil.


func (c *Container) GetAclRule() acl.RejectFunc {
return func(ctx context.Context, request interface{}) (reason error) {
cfg := c.config.Load().(*DegradationConfig)

Choose a reason for hiding this comment

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

When users do not configure degration in kitex_client.json, this cfg would be nil.
You can take a try.

Choose a reason for hiding this comment

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

Actually, you just need to check whether cfg == nil here.

Timeout map[string]*rpctimeout.RPCTimeout `mapstructure:"timeout"` // key: method, "*" for default
Retry map[string]*retry.Policy `mapstructure:"retry"` // key: method, "*" for default
Circuitbreaker map[string]*circuitbreak.CBConfig `mapstructure:"circuitbreaker"` // key: method
Degradation map[string]*degradation.DegradationConfig `mapstructure:"degradation"`

Choose a reason for hiding this comment

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

Why did you use map?


func (c *Container) GetAclRule() acl.RejectFunc {
return func(ctx context.Context, request interface{}) (reason error) {
cfg := c.config.Load().(*DegradationConfig)

Choose a reason for hiding this comment

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

Actually, you just need to check whether cfg == nil here.

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.

2 participants