func (sdp *healthCheckingPublisher) updateHealth(ctx context.Context, lease *etcd_client.LeaseGrantResponse, evt HealthChangeEvent) {
key := fmt.Sprintf("/sd/_health/%016x", lease.ID)
+ shardRegion := ""
+ advHostParts := strings.Split(sdp.publisher.AdvertiseHost, ".")
+ if len(advHostParts) >= 2 {
+ shardRegion = advHostParts[1]
+ } else if hostname.Containerization() == hostname.ContainerKubernetes {
+ shardRegion = "k8s"
+ } else {
+ shardRegion = "unknown"
+ }
+
hr := SDHealthReport{
Up: evt.Status == ServiceUp,
Service: sdp.publisher.Service,
Domain: sdp.publisher.Domain,
Shard: sdp.publisher.ShardName,
Node: sdp.publisher.NodeName,
- ShardRegion: strings.Split(sdp.publisher.AdvertiseHost, ".")[1],
+ ShardRegion: shardRegion,
Protocol: sdp.healthcheck.ServiceDefinition().Engine,
MonitorHost: hostname.Fqdn(),
MonitorRegion: hostname.RegionName(),