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

make EntryOptions support storing custom data before Sentinel.Entry() #124

Merged
merged 2 commits into from
Apr 10, 2020

Conversation

novoland
Copy link
Contributor

Describe what this PR does / why we need it

We need to pass some data about current invocation to slots, while these data is parsed before Sentinel.Entry(). EntryOptions is a suitable place but extra attribute is required.

Does this pull request fix one issue?

None.

Describe how you did it

Add a map data map[string]interface{} (and several functions associated) to EntryOptions.

Describe how to verify it

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Apr 10, 2020

CLA assistant check
All committers have signed the CLA.

@sczyh30 sczyh30 added the kind/enhancement Category issues or PRs related to enhancement label Apr 10, 2020
@sczyh30 sczyh30 linked an issue Apr 10, 2020 that may be closed by this pull request
api/api.go Outdated Show resolved Hide resolved
core/base/context.go Outdated Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #124 into master will decrease coverage by 0.10%.
The diff coverage is 11.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #124      +/-   ##
==========================================
- Coverage   43.38%   43.28%   -0.11%     
==========================================
  Files          67       67              
  Lines        2828     2837       +9     
==========================================
+ Hits         1227     1228       +1     
- Misses       1463     1471       +8     
  Partials      138      138              
Impacted Files Coverage Δ
core/base/context.go 52.38% <ø> (ø)
api/api.go 29.62% <11.11%> (-3.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e93e71a...03ab115. Read the comment docs.

sczyh30
sczyh30 previously approved these changes Apr 10, 2020
Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

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

LGTM

@sczyh30 sczyh30 dismissed their stale review April 10, 2020 11:12

Please reformat the code with gofmt

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

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

LGTM

@sczyh30 sczyh30 merged commit 76070e1 into alibaba:master Apr 10, 2020
@sczyh30
Copy link
Member

sczyh30 commented Apr 10, 2020

Thanks for contributing!

ansiz pushed a commit to ansiz/sentinel-golang that referenced this pull request Dec 22, 2020
Support carrying additional attachments with sentinel.Entry(options) (alibaba#124)

* make EntryOptions support carrying attachment data
* make the `data` field of SentinelInput / SentinelOutput public and rename to `Attachments`

Add MetricEventMonitorBlock

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

Polish MetricItem with monitor-block metric event (alibaba#127)

Sync special/metric-event branch with master (alibaba#136)

* make EntryOptions support storing custom data before Sentinel.Entry()
* make data of SentinelInput / SentinelOutput public & rename to attachment
* remove unnecessary check for slidingWindowMetric.intervalInMs
* Polish code of buildFlowMap in flow/rule_manager.go (alibaba#131)
* Remove unnecessary division checking for interval of SlidingWindowMetric (alibaba#134)

Co-authored-by: sdttttt <42728902+sdttttt@users.noreply.github.com>

Add max concurrency statistic data (alibaba#138)

Add support for getting max concurrency of the latest second (alibaba#140)

feat: add SecondMaxConcurrency field to MetricItem (alibaba#145)

feat: allow to disable metric log flush in runtime (alibaba#147)
sczyh30 pushed a commit that referenced this pull request Dec 22, 2020
Support carrying additional attachments with sentinel.Entry(options) (#124)

* make EntryOptions support carrying attachment data
* make the `data` field of SentinelInput / SentinelOutput public and rename to `Attachments`

Add MetricEventMonitorBlock

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

Polish MetricItem with monitor-block metric event (#127)

Sync special/metric-event branch with master (#136)

* make EntryOptions support storing custom data before Sentinel.Entry()
* make data of SentinelInput / SentinelOutput public & rename to attachment
* remove unnecessary check for slidingWindowMetric.intervalInMs
* Polish code of buildFlowMap in flow/rule_manager.go (#131)
* Remove unnecessary division checking for interval of SlidingWindowMetric (#134)

Co-authored-by: sdttttt <42728902+sdttttt@users.noreply.github.com>

Add max concurrency statistic data (#138)

Add support for getting max concurrency of the latest second (#140)

feat: add SecondMaxConcurrency field to MetricItem (#145)

feat: allow to disable metric log flush in runtime (#147)
sczyh30 pushed a commit that referenced this pull request Dec 22, 2020
* sycn special branch commits

Support carrying additional attachments with sentinel.Entry(options) (#124)

* make EntryOptions support carrying attachment data
* make the `data` field of SentinelInput / SentinelOutput public and rename to `Attachments`

Add MetricEventMonitorBlock

Signed-off-by: Eric Zhao <sczyh16@gmail.com>

Polish MetricItem with monitor-block metric event (#127)

Sync special/metric-event branch with master (#136)

* make EntryOptions support storing custom data before Sentinel.Entry()
* make data of SentinelInput / SentinelOutput public & rename to attachment
* remove unnecessary check for slidingWindowMetric.intervalInMs
* Polish code of buildFlowMap in flow/rule_manager.go (#131)
* Remove unnecessary division checking for interval of SlidingWindowMetric (#134)

Co-authored-by: sdttttt <42728902+sdttttt@users.noreply.github.com>

Add max concurrency statistic data (#138)

Add support for getting max concurrency of the latest second (#140)

feat: add SecondMaxConcurrency field to MetricItem (#145)

feat: allow to disable metric log flush in runtime (#147)

* fix: fix broken test code

* hotspot_rule_add_paramKey

* concurrent processing(error group) for ExtractArgs Iteration

* refmt

* goimports

Co-authored-by: Liu Jing <anderson.liuj@antfin.com>
Co-authored-by: cafra <2443591230@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or PRs related to enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support additional attachments with sentinel.Entry(options)
4 participants