-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed redis-jedis example, added annotation rate limit to redis-jedis… (
#346) * fixed redis-jedis example, added annotation rate limit to redis-jedis example, added Metrics to annotation rate limit * removed IP specific stuff from the context project, removed spring-boot-starter-aop dependency from main project, added defaultMethodMetricTags to Bucket4JBootProperties, adjusted jedis-redis example, improved documentation * fixed XSS vulnerability, adjusted documentation * fixed XSS vulnerability, adjusted documentation --------- Co-authored-by: MarcGiffing <[email protected]>
- Loading branch information
1 parent
b5cf485
commit 9294b3e
Showing
22 changed files
with
579 additions
and
250 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
34 changes: 25 additions & 9 deletions
34
...xt/src/main/java/com/giffing/bucket4j/spring/boot/starter/context/properties/Metrics.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 |
---|---|---|
@@ -1,21 +1,37 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.context.properties; | ||
|
||
import com.giffing.bucket4j.spring.boot.starter.context.metrics.MetricType; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import com.giffing.bucket4j.spring.boot.starter.context.metrics.MetricType; | ||
|
||
import lombok.Data; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@Data | ||
public class Metrics implements Serializable { | ||
|
||
private boolean enabled = true; | ||
private List<MetricType> types = Arrays.asList(MetricType.values()); | ||
private List<MetricTag> tags = new ArrayList<>(); | ||
private boolean enabled = true; | ||
|
||
private List<MetricType> types = Arrays.asList(MetricType.values()); | ||
|
||
private List<MetricTag> tags = new ArrayList<>(); | ||
|
||
public Metrics(List<MetricTag> metricTags) { | ||
Optional.ofNullable(metricTags).ifPresent(tags -> tags.forEach(tag -> { | ||
this.tags.add(tag); | ||
tag.getTypes().forEach(type -> { | ||
if (!types.contains(type)) { | ||
types.add(type); | ||
} | ||
}); | ||
})); | ||
} | ||
} |
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.