702
703
// DescribeHistoryHost returns information about the internal states of a history host
704
>
func (h *Handler) DescribeHistoryHost(_ context.Context, req *historyservice.DescribeHistoryHostRequest) (*historyservice.DescribeHistoryHostResponse, error) {
handler.go
705
>
// This API supports describe history host by 1. address 2. shard id 3. namespace id + workflow id
706
>
// if option 2/3 is provided, we want to check on the shard ownership to return the correct host address.
707
>
shardID := req.GetShardId()
708
>
if len(req.GetNamespaceId()) != 0 && req.GetWorkflowExecution() != nil {
709
shardID = common.WorkflowIDToHistoryShard(req.GetNamespaceId(), req.GetWorkflowExecution().GetWorkflowId(), h.config.NumberOfShards)
710
}
712
>
_, err := h.controller.GetShardByID(shardID)
713
>
if err != nil {
714
>
return nil, err
715
>
}
716
}
717
718
>
itemsInRegistryByIDCount, itemsInRegistryByNameCount := h.namespaceRegistry.GetRegistrySize()
handler.go
719
>
ownedShardIDs := h.controller.ShardIDs()
720
>
resp := &historyservice.DescribeHistoryHostResponse{
721
>
ShardsNumber: int32(len(ownedShardIDs)),
722
>
ShardIds: ownedShardIDs,
723
>
NamespaceCache: &namespacespb.NamespaceCacheInfo{
724
>
ItemsInCacheByIdCount: itemsInRegistryByIDCount,
725
>
ItemsInCacheByNameCount: itemsInRegistryByNameCount,
726
>
},
727
>
Address: h.hostInfoProvider.HostInfo().GetAddress(),
728
>
}
729
>
return resp, nil
730
}
731