-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add single server rate limit (#6756)
* feature: add single server rale limit * fix: fix RateLimitInfo * fix: fix ResultCodeTest * fix: fix TokenBucketLimiterTest * fix: fix pmd output * fix: fix pmd output * fix: fix pmd output * fix: fix pmd * fix: add relate config * fix: fix bucketTokenNumPerSecond config * feat: add ratelimit hot config and del counter metrics * feat: add ratelimit hot config and del counter metrics * feat: add RateLimiterHandlerConfig license * fix: fix MockFailureHandlerImpl * fix: fix pom.xml pmd * fix: fix pmd check * fix: fix pmd check * fix: fix errer code in client * fix: fix tm modify * fix: fix tm modify * fix: fix as review by funky * fix: add limit chain * style: fix import code style * style: fix import code style * style: fix pmd check * fix: fix as code review --------- Co-authored-by: Lei Zhiyuan <[email protected]> Co-authored-by: jimin <[email protected]> Co-authored-by: funkye <[email protected]> Co-authored-by: xingfudeshi <[email protected]>
- Loading branch information
1 parent
ab4574e
commit 4ed95e4
Showing
37 changed files
with
1,125 additions
and
14 deletions.
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
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
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
||
/** | ||
* The type Default failure handler. | ||
*/ | ||
|
104 changes: 104 additions & 0 deletions
104
core/src/main/java/org/apache/seata/core/event/RateLimitEvent.java
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.seata.core.event; | ||
|
||
public class RateLimitEvent implements Event { | ||
|
||
/** | ||
* The Trace id. | ||
*/ | ||
private String traceId; | ||
|
||
/** | ||
* The Limit type (like GlobalBeginFailed). | ||
*/ | ||
private String limitType; | ||
|
||
/** | ||
* The Application id. | ||
*/ | ||
private String applicationId; | ||
|
||
/** | ||
* The Client id. | ||
*/ | ||
private String clientId; | ||
|
||
/** | ||
* The Server ip address and port. | ||
*/ | ||
private String serverIpAddressAndPort; | ||
|
||
public String getTraceId() { | ||
return traceId; | ||
} | ||
|
||
public void setTraceId(String traceId) { | ||
this.traceId = traceId; | ||
} | ||
|
||
public String getLimitType() { | ||
return limitType; | ||
} | ||
|
||
public void setLimitType(String limitType) { | ||
this.limitType = limitType; | ||
} | ||
|
||
public String getApplicationId() { | ||
return applicationId; | ||
} | ||
|
||
public void setApplicationId(String applicationId) { | ||
this.applicationId = applicationId; | ||
} | ||
|
||
public String getClientId() { | ||
return clientId; | ||
} | ||
|
||
public void setClientId(String clientId) { | ||
this.clientId = clientId; | ||
} | ||
|
||
public String getServerIpAddressAndPort() { | ||
return serverIpAddressAndPort; | ||
} | ||
|
||
public void setServerIpAddressAndPort(String serverIpAddressAndPort) { | ||
this.serverIpAddressAndPort = serverIpAddressAndPort; | ||
} | ||
|
||
public RateLimitEvent(String traceId, String limitType, String applicationId, String clientId, String serverIpAddressAndPort) { | ||
this.traceId = traceId; | ||
this.limitType = limitType; | ||
this.applicationId = applicationId; | ||
this.clientId = clientId; | ||
this.serverIpAddressAndPort = serverIpAddressAndPort; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "RateLimitEvent{" + | ||
"traceId='" + traceId + '\'' + | ||
", limitType='" + limitType + '\'' + | ||
", applicationId='" + applicationId + '\'' + | ||
", clientId='" + clientId + '\'' + | ||
", serverIpAddressAndPort='" + serverIpAddressAndPort + '\'' + | ||
'}'; | ||
} | ||
} |
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
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
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.