package metered

// Code generated by gowrap. DO NOT EDIT.
// template: ../../templates/metered.tmpl
// gowrap: http://github.com/hexdigest/gowrap

import (
	"context"

	"go.uber.org/yarpc"

	"github.com/uber/cadence/client/admin"
	"github.com/uber/cadence/common/metrics"
	"github.com/uber/cadence/common/types"
)

// adminClient implements admin.Client interface instrumented with retries
type adminClient struct {
	client        admin.Client
	metricsClient metrics.Client
}

// NewAdminClient creates a new instance of adminClient with retry policy
func NewAdminClient(client admin.Client, metricsClient metrics.Client) admin.Client {
	return &adminClient{
		client:        client,
		metricsClient: metricsClient,
	}
}

func (c *adminClient) AddSearchAttribute(ctx context.Context, ap1 *types.AddSearchAttributeRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientAddSearchAttributeScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientAddSearchAttributeScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.AddSearchAttribute(ctx, ap1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) CloseShard(ctx context.Context, cp1 *types.CloseShardRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientCloseShardScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientCloseShardScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.CloseShard(ctx, cp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) CountDLQMessages(ctx context.Context, cp1 *types.CountDLQMessagesRequest, p1 ...yarpc.CallOption) (cp2 *types.CountDLQMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientCountDLQMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientCountDLQMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	cp2, err = c.client.CountDLQMessages(ctx, cp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return cp2, err
}

func (c *adminClient) DeleteWorkflow(ctx context.Context, ap1 *types.AdminDeleteWorkflowRequest, p1 ...yarpc.CallOption) (ap2 *types.AdminDeleteWorkflowResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDeleteWorkflowScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDeleteWorkflowScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	ap2, err = c.client.DeleteWorkflow(ctx, ap1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return ap2, err
}

func (c *adminClient) DescribeCluster(ctx context.Context, p1 ...yarpc.CallOption) (dp1 *types.DescribeClusterResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeClusterScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeClusterScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	dp1, err = c.client.DescribeCluster(ctx, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return dp1, err
}

func (c *adminClient) DescribeHistoryHost(ctx context.Context, dp1 *types.DescribeHistoryHostRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeHistoryHostResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeHistoryHostScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeHistoryHostScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	dp2, err = c.client.DescribeHistoryHost(ctx, dp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return dp2, err
}

func (c *adminClient) DescribeQueue(ctx context.Context, dp1 *types.DescribeQueueRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeQueueResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeQueueScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeQueueScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	dp2, err = c.client.DescribeQueue(ctx, dp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return dp2, err
}

func (c *adminClient) DescribeShardDistribution(ctx context.Context, dp1 *types.DescribeShardDistributionRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeShardDistributionResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeShardDistributionScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeShardDistributionScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	dp2, err = c.client.DescribeShardDistribution(ctx, dp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return dp2, err
}

func (c *adminClient) DescribeWorkflowExecution(ctx context.Context, ap1 *types.AdminDescribeWorkflowExecutionRequest, p1 ...yarpc.CallOption) (ap2 *types.AdminDescribeWorkflowExecutionResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeWorkflowExecutionScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientDescribeWorkflowExecutionScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	ap2, err = c.client.DescribeWorkflowExecution(ctx, ap1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return ap2, err
}

func (c *adminClient) GetDLQReplicationMessages(ctx context.Context, gp1 *types.GetDLQReplicationMessagesRequest, p1 ...yarpc.CallOption) (gp2 *types.GetDLQReplicationMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDLQReplicationMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDLQReplicationMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp2, err = c.client.GetDLQReplicationMessages(ctx, gp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp2, err
}

func (c *adminClient) GetDomainAsyncWorkflowConfiguraton(ctx context.Context, request *types.GetDomainAsyncWorkflowConfiguratonRequest, opts ...yarpc.CallOption) (gp1 *types.GetDomainAsyncWorkflowConfiguratonResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainAsyncWorkflowConfiguratonScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainAsyncWorkflowConfiguratonScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp1, err = c.client.GetDomainAsyncWorkflowConfiguraton(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp1, err
}

func (c *adminClient) GetDomainIsolationGroups(ctx context.Context, request *types.GetDomainIsolationGroupsRequest, opts ...yarpc.CallOption) (gp1 *types.GetDomainIsolationGroupsResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainIsolationGroupsScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainIsolationGroupsScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp1, err = c.client.GetDomainIsolationGroups(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp1, err
}

func (c *adminClient) GetDomainReplicationMessages(ctx context.Context, gp1 *types.GetDomainReplicationMessagesRequest, p1 ...yarpc.CallOption) (gp2 *types.GetDomainReplicationMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainReplicationMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDomainReplicationMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp2, err = c.client.GetDomainReplicationMessages(ctx, gp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp2, err
}

func (c *adminClient) GetDynamicConfig(ctx context.Context, gp1 *types.GetDynamicConfigRequest, p1 ...yarpc.CallOption) (gp2 *types.GetDynamicConfigResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDynamicConfigScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetDynamicConfigScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp2, err = c.client.GetDynamicConfig(ctx, gp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp2, err
}

func (c *adminClient) GetGlobalIsolationGroups(ctx context.Context, request *types.GetGlobalIsolationGroupsRequest, opts ...yarpc.CallOption) (gp1 *types.GetGlobalIsolationGroupsResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetGlobalIsolationGroupsScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetGlobalIsolationGroupsScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp1, err = c.client.GetGlobalIsolationGroups(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp1, err
}

func (c *adminClient) GetReplicationMessages(ctx context.Context, gp1 *types.GetReplicationMessagesRequest, p1 ...yarpc.CallOption) (gp2 *types.GetReplicationMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetReplicationMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetReplicationMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp2, err = c.client.GetReplicationMessages(ctx, gp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp2, err
}

func (c *adminClient) GetWorkflowExecutionRawHistoryV2(ctx context.Context, gp1 *types.GetWorkflowExecutionRawHistoryV2Request, p1 ...yarpc.CallOption) (gp2 *types.GetWorkflowExecutionRawHistoryV2Response, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientGetWorkflowExecutionRawHistoryV2Scope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientGetWorkflowExecutionRawHistoryV2Scope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	gp2, err = c.client.GetWorkflowExecutionRawHistoryV2(ctx, gp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return gp2, err
}

func (c *adminClient) ListDynamicConfig(ctx context.Context, lp1 *types.ListDynamicConfigRequest, p1 ...yarpc.CallOption) (lp2 *types.ListDynamicConfigResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientListDynamicConfigScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientListDynamicConfigScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	lp2, err = c.client.ListDynamicConfig(ctx, lp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return lp2, err
}

func (c *adminClient) MaintainCorruptWorkflow(ctx context.Context, ap1 *types.AdminMaintainWorkflowRequest, p1 ...yarpc.CallOption) (ap2 *types.AdminMaintainWorkflowResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientMaintainCorruptWorkflowScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientMaintainCorruptWorkflowScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	ap2, err = c.client.MaintainCorruptWorkflow(ctx, ap1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return ap2, err
}

func (c *adminClient) MergeDLQMessages(ctx context.Context, mp1 *types.MergeDLQMessagesRequest, p1 ...yarpc.CallOption) (mp2 *types.MergeDLQMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientMergeDLQMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientMergeDLQMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	mp2, err = c.client.MergeDLQMessages(ctx, mp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return mp2, err
}

func (c *adminClient) PurgeDLQMessages(ctx context.Context, pp1 *types.PurgeDLQMessagesRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientPurgeDLQMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientPurgeDLQMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.PurgeDLQMessages(ctx, pp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) ReadDLQMessages(ctx context.Context, rp1 *types.ReadDLQMessagesRequest, p1 ...yarpc.CallOption) (rp2 *types.ReadDLQMessagesResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientReadDLQMessagesScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientReadDLQMessagesScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	rp2, err = c.client.ReadDLQMessages(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return rp2, err
}

func (c *adminClient) ReapplyEvents(ctx context.Context, rp1 *types.ReapplyEventsRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientReapplyEventsScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientReapplyEventsScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.ReapplyEvents(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) RefreshWorkflowTasks(ctx context.Context, rp1 *types.RefreshWorkflowTasksRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientRefreshWorkflowTasksScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientRefreshWorkflowTasksScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.RefreshWorkflowTasks(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) RemoveTask(ctx context.Context, rp1 *types.RemoveTaskRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientRemoveTaskScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientRemoveTaskScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.RemoveTask(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) ResendReplicationTasks(ctx context.Context, rp1 *types.ResendReplicationTasksRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientResendReplicationTasksScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientResendReplicationTasksScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.ResendReplicationTasks(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) ResetQueue(ctx context.Context, rp1 *types.ResetQueueRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientResetQueueScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientResetQueueScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.ResetQueue(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) RestoreDynamicConfig(ctx context.Context, rp1 *types.RestoreDynamicConfigRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientRestoreDynamicConfigScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientRestoreDynamicConfigScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.RestoreDynamicConfig(ctx, rp1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) UpdateDomainAsyncWorkflowConfiguraton(ctx context.Context, request *types.UpdateDomainAsyncWorkflowConfiguratonRequest, opts ...yarpc.CallOption) (up1 *types.UpdateDomainAsyncWorkflowConfiguratonResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDomainAsyncWorkflowConfiguratonScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDomainAsyncWorkflowConfiguratonScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	up1, err = c.client.UpdateDomainAsyncWorkflowConfiguraton(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return up1, err
}

func (c *adminClient) UpdateDomainIsolationGroups(ctx context.Context, request *types.UpdateDomainIsolationGroupsRequest, opts ...yarpc.CallOption) (up1 *types.UpdateDomainIsolationGroupsResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDomainIsolationGroupsScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDomainIsolationGroupsScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	up1, err = c.client.UpdateDomainIsolationGroups(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return up1, err
}

func (c *adminClient) UpdateDynamicConfig(ctx context.Context, up1 *types.UpdateDynamicConfigRequest, p1 ...yarpc.CallOption) (err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDynamicConfigScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateDynamicConfigScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	err = c.client.UpdateDynamicConfig(ctx, up1, p1...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return err
}

func (c *adminClient) UpdateGlobalIsolationGroups(ctx context.Context, request *types.UpdateGlobalIsolationGroupsRequest, opts ...yarpc.CallOption) (up1 *types.UpdateGlobalIsolationGroupsResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateGlobalIsolationGroupsScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateGlobalIsolationGroupsScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	up1, err = c.client.UpdateGlobalIsolationGroups(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return up1, err
}

func (c *adminClient) UpdateTaskListPartitionConfig(ctx context.Context, request *types.UpdateTaskListPartitionConfigRequest, opts ...yarpc.CallOption) (up1 *types.UpdateTaskListPartitionConfigResponse, err error) {
	retryCount := getRetryCountFromContext(ctx)

	var scope metrics.Scope
	if retryCount == -1 {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateTaskListPartitionConfigScope)
	} else {
		scope = c.metricsClient.Scope(metrics.AdminClientUpdateTaskListPartitionConfigScope, metrics.IsRetryTag(retryCount > 0))
	}

	scope.IncCounter(metrics.CadenceClientRequests)

	sw := scope.StartTimer(metrics.CadenceClientLatency)
	up1, err = c.client.UpdateTaskListPartitionConfig(ctx, request, opts...)
	sw.Stop()

	if err != nil {
		scope.IncCounter(metrics.CadenceClientFailures)
	}
	return up1, err
}
