spring-cloud-netflix icon indicating copy to clipboard operation
spring-cloud-netflix copied to clipboard

Eureka datacenter and environment not displayed on the Eureka dashboard

Open pradeepkl opened this issue 5 years ago • 4 comments

I am using Eureka server - version 3.0.3 and have configured the datacenter and environment information using the below configuration:

eureka:
  datacenter: Mumbai
  environment: QA
  server:
    enable-self-preservation: false
  instance:
    lease-renewal-interval-in-seconds: 30
    lease-expiration-duration-in-seconds: 90
  client:
    register-with-eureka: false
    fetch-registry: false

I do not see the Datacenter and Environment information in the Eureka dashboard. In the older versions of Eureka, the information used to be displayed. Is there any change in the configuration with the current release?

pradeepkl avatar Sep 14 '21 08:09 pradeepkl

Ok i have the same problem.

weixsun avatar Nov 16 '21 17:11 weixsun

This was broken while removing Archaius.

Changed from:

model.put("environment",
				ConfigurationManager.getDeploymentContext().getDeploymentEnvironment());
model.put("datacenter",
				ConfigurationManager.getDeploymentContext().getDeploymentDatacenter());

to:

model.put("environment", "N/A"); 
model.put("datacenter", "N/A");

in EurekaController.

OlgaMaciaszek avatar Dec 15 '21 12:12 OlgaMaciaszek

This was broken while removing Archaius.

Changed from:

model.put("environment",
				ConfigurationManager.getDeploymentContext().getDeploymentEnvironment());
model.put("datacenter",
				ConfigurationManager.getDeploymentContext().getDeploymentDatacenter());

to:

model.put("environment", "N/A"); 
model.put("datacenter", "N/A");

in EurekaController.

what is the right way currently to set those values?

user20161119 avatar Feb 22 '22 01:02 user20161119

@user20161119

what is the right way currently to set those values?

Create a package named org.springframework.cloud.netflix.eureka.server and full copy EurekaController in your project.

Then the easiest way is to inject these two configuration items via @Value

public class EurekaController {

	@Value("${eureka.environment:test}")
	private String environment;

	@Value("${eureka.datacenter:default}")
	private String datacenter;

        model.put("environment", environment);
	model.put("datacenter", datacenter);

weixsun avatar Apr 11 '22 16:04 weixsun