func addQueries(content []byte, pgVersion semver.Version, server *Server) error {
	metricMaps, newQueryOverrides, err := parseUserQueries(content)
	if err != nil {
		return err
	}
	// Convert the loaded metric map into exporter representation
	partialExporterMap := makeDescMap(pgVersion, server.labels, metricMaps)

	// Merge the two maps (which are now quite flatteend)
	for k, v := range partialExporterMap {
		_, found := server.metricMap[k]
		if found {
			log.Debugln("Overriding metric", k, "from user YAML file.")
		} else {
			log.Debugln("Adding new metric", k, "from user YAML file.")
		}
		server.metricMap[k] = v
	}

	// Merge the query override map
	for k, v := range newQueryOverrides {
		_, found := server.queryOverrides[k]
		if found {
			log.Debugln("Overriding query override", k, "from user YAML file.")
		} else {
			log.Debugln("Adding new query override", k, "from user YAML file.")
		}
		server.queryOverrides[k] = v
	}
	return nil
}
// Add queries to the builtinMetricMaps and queryOverrides maps. Added queries do not
// respect version requirements, because it is assumed that the user knows
// what they are doing with their version of postgres.
//
// This function modifies metricMap and queryOverrideMap to contain the new
// queries.
// TODO: test code for all cu.
// TODO: the YAML this supports is "non-standard" - we should move away from it.
Add queries to the builtinMetricMaps and queryOverrides maps. Added queries do not
respect version requirements, because it is assumed that the user knows
what they are doing with their version of postgres.

This function modifies metricMap and queryOverrideMap to contain the new
queries.
TODO: test code for all cu.
TODO: the YAML this supports is "non-standard" - we should move away from it.
// Add queries to the builtinMetricMaps and queryOverrides maps . Added queries do not // respect version requirements because it is assumed that the user knows // what they are doing with their version of postgres . // // This function modifies metricMap and queryOverrideMap to contain the new // queries . // TODO : test code for all cu . // TODO : the YAML this supports is " non - standard " - we should move away from it .
func addQueries(content []byte, pgVersion semver.Version, server *Server) error {
	metricMaps, newQueryOverrides, err := parseUserQueries(content)
	if err != nil {
		return err
	}
	partialExporterMap := makeDescMap(pgVersion, server.labels, metricMaps)
	for k, v := range partialExporterMap {
		_, found := server.metricMap[k]
		if found {
			log.Debugln("Overriding metric", k, "from user YAML file.")
		} else {
			log.Debugln("Adding new metric", k, "from user YAML file.")
		}
		server.metricMap[k] = v
	}
	for k, v := range newQueryOverrides {
		_, found := server.queryOverrides[k]
		if found {
			log.Debugln("Overriding query override", k, "from user YAML file.")
		} else {
			log.Debugln("Adding new query override", k, "from user YAML file.")
		}
		server.queryOverrides[k] = v
	}
	return nil
}
func addQueries ( content [ ] byte , pgVersion semver . Version , server * Server ) error { metricMaps , newQueryOverrides , err := parseUserQueries ( content ) if err != nil { return err } partialExporterMap := makeDescMap ( pgVersion , server . labels , metricMaps ) for k , v := range partialExporterMap { _ , found := server . metricMap [ k ] if found { log . Debugln ( " " , k , " " ) } else { log . Debugln ( " " , k , " " ) } server . metricMap [ k ] = v } for k , v := range newQueryOverrides { _ , found := server . queryOverrides [ k ] if found { log . Debugln ( " " , k , " " ) } else { log . Debugln ( " " , k , " " ) } server . queryOverrides [ k ] = v } return nil }
Add queries to the builtinMetricMaps and queryOverrides maps.
Add queries to the builtinMetricMaps and queryOverrides maps .
// Convert the loaded metric map into exporter representation // Merge the two maps (which are now quite flatteend) // Merge the query override map