func parseAndLogAgentVersion()

in main/utils.go [32:46]


func parseAndLogAgentVersion(lg ExtensionLogger, agentName string) (agentVersion string, err error) {
	r, _ := regexp.Compile(AgentVersionRegex)
	matches := r.FindStringSubmatch(agentName)
	if len(matches) != 4 {
		return "", errors.New("incorrect naming format for agent")
	}
	// get the agent version
	agentVersion = matches[2]

	// logging and telemetry for agent version
	lg.customLog(logEvent, "current agent version", logVersion, agentVersion)
	telemetry(TelemetryScenario, "Current agent version: "+agentVersion, true, 0)

	return agentVersion, nil
}