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

Refactor the extended MetricExtension interface to match fundamental events in Sentinel #1675

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Aug 18, 2020

Describe what this PR does / why we need it

Refactor the extended AdvancedMetricExtension interface (new added in #1665) to match fundamental events (pass, block, complete) in Sentinel.

Does this pull request fix one issue?

Improvement for #1665

Describe how you did it

  • Unify the extended interface as a few event handlers: onPass, onBlocked, onComplete and onError
  • Polish related code

Describe how to verify it

Run all test cases for regression.

Special notes for reviews

NONE

…nel)

- Unify the extended interface as a few event handlers: onPass, onBlocked, onComplete and onError
- Polish related code

Signed-off-by: Eric Zhao <[email protected]>
@sczyh30 sczyh30 added priority/high Very important, need to be worked with soon but not very urgent area/metrics Issues or PRs related to metrics and monitoring kind/refactor Issue related to functional refactoring. labels Aug 18, 2020
@sczyh30 sczyh30 added this to the 1.8.0 milestone Aug 18, 2020
@sczyh30 sczyh30 requested review from jasonjoo2010 and cdfive August 18, 2020 09:36
@jasonjoo2010
Copy link
Collaborator

I have done a quick overview on this pr.
First as a background the previous contribution has never ever been released (#1665), right?

So my concern is that why we insist on keeping the inheritance between event style interface and counter style interface(legacy one)? Since anyone who wants to implement "Advanced" one must implement interfaces, addPass/onPass, addBlock/onBlock, etc., altogether even he only want to follow the method group of event style. Is there any constraint we must merge them into a base, non-empty interface type?

Normally and mostly we may use an empty base interface for referencing and do type detection later. Sure for backward compatibility this way should not be used.

Another thought is that we can separate them into independent interfaces and maintain in two registries or collections.

I will continue to do a quick review after we make these clear.

@sczyh30
Copy link
Member Author

sczyh30 commented Aug 19, 2020

I have done a quick overview on this pr.
First as a background the previous contribution has never ever been released (#1665), right?

Yes, it's not released yet.

So my concern is that why we insist on keeping the inheritance between event style interface and counter style interface(legacy one)? Since anyone who wants to implement "Advanced" one must implement interfaces, addPass/onPass, addBlock/onBlock, etc., altogether even he only want to follow the method group of event style. Is there any constraint we must merge them into a base, non-empty interface type?

Normally and mostly we may use an empty base interface for referencing and do type detection later. Sure for backward compatibility this way should not be used.

Another thought is that we can separate them into independent interfaces and maintain in two registries or collections.

This is only a temporary workaround for backward compatibility (as some other libraries has been integrating with the SPI). Actually I was planning to deprecate the legacy MetricExtension hierarchy in upcoming versions and make the metric hook as the "canonical" event style.

@jasonjoo2010
Copy link
Collaborator

This is only a temporary workaround for backward compatibility (as some other libraries has been integrating with the SPI). Actually I was planning to deprecate the legacy MetricExtension hierarchy in upcoming versions and make the metric hook as the "canonical" event style.

Understood.
So how does the canonical look like? Is it still in designing?
If so we may mainly do some renaming in this pr and abandon it after a few iterations, right?

@sczyh30
Copy link
Member Author

sczyh30 commented Aug 19, 2020

So how does the canonical look like? Is it still in designing?

It's not settled down. Discussions are needed later.

If so we may mainly do some renaming in this pr and abandon it after a few iterations, right?

That's it.

@jasonjoo2010
Copy link
Collaborator

So how does the canonical look like? Is it still in designing?

It's not settled down. Discussions are needed later.

If so we may mainly do some renaming in this pr and abandon it after a few iterations, right?

That's it.

Got it now and I have no further question.

Copy link
Collaborator

@jasonjoo2010 jasonjoo2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@jasonjoo2010 jasonjoo2010 merged commit a882887 into master Aug 19, 2020
@sczyh30 sczyh30 deleted the refactor/extended-metric-extension branch August 19, 2020 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Issues or PRs related to metrics and monitoring kind/refactor Issue related to functional refactoring. priority/high Very important, need to be worked with soon but not very urgent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants