// renderQuery applies the given variant args to the query template.
renderQuery applies the given variant args to the query template.
// renderQuery applies the given variant args to the query template .
func (a *metricsAnalyzer) renderQuery(queryTemplate string, variantCustomArgs map[string]string, variant string) (string, error) {
	args := argsTemplate{
		Variant:           variantArgs{Name: variant},
		VariantCustomArgs: variantCustomArgs,
		App:               a.argsTemplate.App,
		K8s:               a.argsTemplate.K8s,
		AppCustomArgs:     a.argsTemplate.AppCustomArgs,
	}
	t, err := template.New("AnalysisTemplate").Parse(queryTemplate)
	if err != nil {
		return "", fmt.Errorf("failed to parse query template: %w", err)
	}
	b := new(bytes.Buffer)
	if err := t.Execute(b, args); err != nil {
		return "", fmt.Errorf("failed to apply template: %w", err)
	}
	return b.String(), err
}
func ( a * metricsAnalyzer ) renderQuery ( queryTemplate string , variantCustomArgs map [ string ] string , variant string ) ( string , error ) { args := argsTemplate { Variant : variantArgs { Name : variant } , VariantCustomArgs : variantCustomArgs , App : a . argsTemplate . App , K8s : a . argsTemplate . K8s , AppCustomArgs : a . argsTemplate . AppCustomArgs , } t , err := template . New ( " " ) . Parse ( queryTemplate ) if err != nil { return " " , fmt . Errorf ( " " , err ) } b := new ( bytes . Buffer ) if err := t . Execute ( b , args ) ; err != nil { return " " , fmt . Errorf ( " " , err ) } return b . String ( ) , err }
renderQuery applies the given variant args to the query template.
renderQuery applies the given variant args to the query template .