Skip to content

Commit

Permalink
client: move WithCallerComponent from RPCClient to Client (#8943)
Browse files Browse the repository at this point in the history
ref #8593

Signed-off-by: okJiang <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
okJiang and ti-chi-bot[bot] authored Dec 20, 2024
1 parent 0e5d49f commit 461b86a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ type RPCClient interface {
// SetExternalTimestamp sets external timestamp
SetExternalTimestamp(ctx context.Context, timestamp uint64) error

// WithCallerComponent returns a new RPCClient with the specified caller
// component. Caller component refers to the specific part or module within
// the process. You can set the component in two ways:
// * Define it manually, like `caller.Component("DDL")`.
// * Use the provided helper function, `caller.GetComponent(upperLayer)`.
// The upperLayer parameter specifies the depth of the caller stack,
// where 0 means the current function. Adjust the upperLayer value based
// on your needs.
WithCallerComponent(callerComponent caller.Component) RPCClient

router.Client
tso.Client
metastorage.Client
Expand All @@ -138,6 +128,15 @@ type Client interface {

// UpdateOption updates the client option.
UpdateOption(option opt.DynamicOption, value any) error
// WithCallerComponent returns a new Client with the specified caller
// component. Caller component refers to the specific part or module within
// the process. You can set the component in two ways:
// * Define it manually, like `caller.Component("DDL")`.
// * Use the provided helper function, `caller.GetComponent(upperLayer)`.
// The upperLayer parameter specifies the depth of the caller stack,
// where 0 means the current function. Adjust the upperLayer value based
// on your needs.
WithCallerComponent(callerComponent caller.Component) Client

// Close closes the client.
Close()
Expand Down Expand Up @@ -1364,7 +1363,7 @@ func (c *client) respForErr(observer prometheus.Observer, start time.Time, err e
}

// WithCallerComponent implements the RPCClient interface.
func (c *client) WithCallerComponent(callerComponent caller.Component) RPCClient {
func (c *client) WithCallerComponent(callerComponent caller.Component) Client {
newClient := *c
newClient.callerComponent = callerComponent
return &newClient
Expand Down

0 comments on commit 461b86a

Please sign in to comment.