func buildInstances(pc *types.PrometheusCheck, annotations map[string]string, namespacedName string) ([]integration.Data, bool) {
	instances := []integration.Data{}
	for k, v := range pc.AD.KubeAnnotations.Incl {
		if annotations[k] == v {
			log.Debugf("'%s' matched the annotation '%s=%s' to schedule an openmetrics check", namespacedName, k, v)
			for _, instance := range pc.Instances {
				instanceValues := *instance
				if instanceValues.URL == "" {
					instanceValues.URL = types.BuildURL(annotations)
				}
				instanceJSON, err := json.Marshal(instanceValues)
				if err != nil {
					log.Warnf("Error processing prometheus configuration: %v", err)
					continue
				}
				instances = append(instances, instanceJSON)
			}
			return instances, len(instances) > 0
		}
	}

	return instances, false
}
// buildInstances generates check config instances based on the Prometheus config and the object annotations
// The second returned value is true if more than one instance is found
buildInstances generates check config instances based on the Prometheus config and the object annotations
The second returned value is true if more than one instance is found
// buildInstances generates check config instances based on the Prometheus config and the object annotations // The second returned value is true if more than one instance is found
func buildInstances(pc *types.PrometheusCheck, annotations map[string]string, namespacedName string) ([]integration.Data, bool) {
	instances := []integration.Data{}
	for k, v := range pc.AD.KubeAnnotations.Incl {
		if annotations[k] == v {
			log.Debugf("'%s' matched the annotation '%s=%s' to schedule an openmetrics check", namespacedName, k, v)
			for _, instance := range pc.Instances {
				instanceValues := *instance
				if instanceValues.URL == "" {
					instanceValues.URL = types.BuildURL(annotations)
				}
				instanceJSON, err := json.Marshal(instanceValues)
				if err != nil {
					log.Warnf("Error processing prometheus configuration: %v", err)
					continue
				}
				instances = append(instances, instanceJSON)
			}
			return instances, len(instances) > 0
		}
	}
	return instances, false
}
func buildInstances ( pc * types . PrometheusCheck , annotations map [ string ] string , namespacedName string ) ( [ ] integration . Data , bool ) { instances := [ ] integration . Data { } for k , v := range pc . AD . KubeAnnotations . Incl { if annotations [ k ] == v { log . Debugf ( " " , namespacedName , k , v ) for _ , instance := range pc . Instances { instanceValues := * instance if instanceValues . URL == " " { instanceValues . URL = types . BuildURL ( annotations ) } instanceJSON , err := json . Marshal ( instanceValues ) if err != nil { log . Warnf ( " " , err ) continue } instances = append ( instances , instanceJSON ) } return instances , len ( instances ) > 0 } } return instances , false }
buildInstances generates check config instances based on the Prometheus config and the object annotations
The second returned value is true if more than one instance is found
buildInstances generates check config instances based on the Prometheus config and the object annotations The second returned value is true if more than one instance is found