func (wh *WorkflowHandler) CountWorkflowExecutions(
	ctx context.Context,
	countRequest *types.CountWorkflowExecutionsRequest,
) (resp *types.CountWorkflowExecutionsResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendCountWorkflowExecutionsScope, countRequest)
	defer sw.Stop()

	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}

	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}

	if countRequest == nil {
		return nil, wh.error(errRequestNotSet, scope)
	}

	if countRequest.GetDomain() == "" {
		return nil, wh.error(errDomainNotSet, scope)
	}

	if ok := wh.allow(true, countRequest); !ok {
		return nil, wh.error(createServiceBusyError(), scope)
	}

	validatedQuery, err := wh.visibilityQueryValidator.ValidateQuery(countRequest.GetQuery())
	if err != nil {
		return nil, wh.error(err, scope)
	}

	domain := countRequest.GetDomain()
	domainID, err := wh.GetDomainCache().GetDomainID(domain)
	if err != nil {
		return nil, wh.error(err, scope)
	}

	req := &persistence.CountWorkflowExecutionsRequest{
		DomainUUID: domainID,
		Domain:     domain,
		Query:      validatedQuery,
	}
	persistenceResp, err := wh.GetVisibilityManager().CountWorkflowExecutions(ctx, req)
	if err != nil {
		return nil, wh.error(err, scope)
	}

	resp = &types.CountWorkflowExecutionsResponse{
		Count: persistenceResp.Count,
	}
	return resp, nil
}
// CountWorkflowExecutions - count number of workflow executions in a domain
count number of workflow executions in a domain
// CountWorkflowExecutions - count number of workflow executions in a domain
func (wh *WorkflowHandler) CountWorkflowExecutions(
	ctx context.Context,
	countRequest *types.CountWorkflowExecutionsRequest,
) (resp *types.CountWorkflowExecutionsResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendCountWorkflowExecutionsScope, countRequest)
	defer sw.Stop()
	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}
	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}
	if countRequest == nil {
		return nil, wh.error(errRequestNotSet, scope)
	}
	if countRequest.GetDomain() == "" {
		return nil, wh.error(errDomainNotSet, scope)
	}
	if ok := wh.allow(true, countRequest); !ok {
		return nil, wh.error(createServiceBusyError(), scope)
	}
	validatedQuery, err := wh.visibilityQueryValidator.ValidateQuery(countRequest.GetQuery())
	if err != nil {
		return nil, wh.error(err, scope)
	}
	domain := countRequest.GetDomain()
	domainID, err := wh.GetDomainCache().GetDomainID(domain)
	if err != nil {
		return nil, wh.error(err, scope)
	}
	req := &persistence.CountWorkflowExecutionsRequest{
		DomainUUID: domainID,
		Domain:     domain,
		Query:      validatedQuery,
	}
	persistenceResp, err := wh.GetVisibilityManager().CountWorkflowExecutions(ctx, req)
	if err != nil {
		return nil, wh.error(err, scope)
	}
	resp = &types.CountWorkflowExecutionsResponse{
		Count: persistenceResp.Count,
	}
	return resp, nil
}
func ( wh * WorkflowHandler ) CountWorkflowExecutions ( ctx context . Context , countRequest * types . CountWorkflowExecutionsRequest , ) ( resp * types . CountWorkflowExecutionsResponse , retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) scope , sw := wh . startRequestProfileWithDomain ( ctx , metrics . FrontendCountWorkflowExecutionsScope , countRequest ) defer sw . Stop ( ) if wh . isShuttingDown ( ) { return nil , errShuttingDown } if err := wh . versionChecker . ClientSupported ( ctx , wh . config . EnableClientVersionCheck ( ) ) ; err != nil { return nil , wh . error ( err , scope ) } if countRequest == nil { return nil , wh . error ( errRequestNotSet , scope ) } if countRequest . GetDomain ( ) == " " { return nil , wh . error ( errDomainNotSet , scope ) } if ok := wh . allow ( true , countRequest ) ; ! ok { return nil , wh . error ( createServiceBusyError ( ) , scope ) } validatedQuery , err := wh . visibilityQueryValidator . ValidateQuery ( countRequest . GetQuery ( ) ) if err != nil { return nil , wh . error ( err , scope ) } domain := countRequest . GetDomain ( ) domainID , err := wh . GetDomainCache ( ) . GetDomainID ( domain ) if err != nil { return nil , wh . error ( err , scope ) } req := & persistence . CountWorkflowExecutionsRequest { DomainUUID : domainID , Domain : domain , Query : validatedQuery , } persistenceResp , err := wh . GetVisibilityManager ( ) . CountWorkflowExecutions ( ctx , req ) if err != nil { return nil , wh . error ( err , scope ) } resp = & types . CountWorkflowExecutionsResponse { Count : persistenceResp . Count , } return resp , nil }
count number of workflow executions in a domain
count number of workflow executions in a domain