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

[Feature] Carry params by key-value in sentinel.Entry | 热点参数埋点支持以 key-value 的方式传入参数 #490

Open
sczyh30 opened this issue Oct 14, 2022 · 3 comments
Assignees
Labels
kind/feature Category issues or PRs related to feature request

Comments

@sczyh30
Copy link
Member

sczyh30 commented Oct 14, 2022

Issue Description

Type: feature request

Describe what feature you want

Support carrying params by key-value in sentinel.Entry(options...). An example:

sentinel.Entry(WithArg("key1", "value1"), WithArg("key2", "value2"));

热点参数埋点支持以 key-value 的方式传入参数,这样开发者可以无需像之前传入 args 一样关心参数顺序,从而更方便的配置热点规则(按照 key 来匹配即可,不需按参数匹配)。

热点规则的设计,以及 Entry API 的设计需要做相应的调整。

Additional context

Add any other context or screenshots about the feature request here.

@sczyh30 sczyh30 added the kind/feature Category issues or PRs related to feature request label Oct 14, 2022
@binbin0325 binbin0325 self-assigned this Oct 31, 2022
@binbin0325
Copy link
Collaborator

目前已支持,如下:

		e, b := sentinel.Entry("abc",
			sentinel.WithArgs(false, uint32(9),
				sentinel.WithAttachments(map[interface{}]interface{}{
					testKey: rand.Uint64() % 10,
				}),
			))

@sczyh30
Copy link
Member Author

sczyh30 commented May 30, 2023

Args, Attachments 的用途,咱们可以在文档里面明确下哈,方便大家进行扩展使用。cc @LearningGp

cc @ansiz 可以看下对扩展性的需求

@ansiz
Copy link
Contributor

ansiz commented May 30, 2023

@sczyh30 我看title上看跟热点限流有关系?但是好像没看到热点限流那边的改动?这个改动有完整的PR链接吗?

我们之前其实已经做过类似的实现,在热点限流支持指定key,再从上下文里提取参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Category issues or PRs related to feature request
Projects
None yet
Development

No branches or pull requests

3 participants