func latestMetricsForEndpoint( metricStore *store.Store, app *datastructs.ApplicationStatus, canonicalPath string, json bool) (result []*messages.LatestMetric) { var appender store.Appender if json { appender = &latestMetricsAppenderJSON{ result: &result, hostName: app.EndpointId.HostName(), appName: app.Name, } } else { appender = &latestMetricsAppender{ result: &result, hostName: app.EndpointId.HostName(), appName: app.Name, } } metricStore.LatestByPrefixAndEndpointStrategy( canonicalPath, app.EndpointId, store.GroupMetricByPathAndNumeric, store.AppenderFilterFunc( appender, func(r *store.Record) bool { return r.Info.Path() == canonicalPath || strings.HasPrefix( r.Info.Path(), canonicalPath+"/") }, ), ) sort.Sort(latestByPath(result)) return }