@Bean @Profile(PRODUCTION) public MetricsBasePath metricsBasePath(@Value("${metrics.path.root:apps}") String rootName, @Value("${metrics.path.environment:#{systemProperties['APP_ENV'] ?: 'test'}}") String environment, @Value("spring.application.name") String springAppName, @Value("${metrics.path.node:#{T(com.ofg.infrastructure.metrics.config.MetricsConfiguration).resolveLocalHostName()}}") String node) { String basePath = zookeeperDiscoveryProperties != null ? zookeeperDiscoveryProperties.getRoot() : serviceConfigurationResolver.getBasePath(); String applicationName = zookeeperDiscoveryProperties != null ? getLastName(springAppName) : serviceConfigurationResolver.getMicroservicePath().getLastName(); String country = env.getProperty("metrics.path.country", basePath); String appName = env.getProperty("metrics.path.app", applicationName); return new EnvironmentAwareMetricsBasePath(rootName, environment, country, appName, node); }