diff --git a/apollo-common/pom.xml b/apollo-common/pom.xml index 1d80968b7d0..28fdd6aa41f 100644 --- a/apollo-common/pom.xml +++ b/apollo-common/pom.xml @@ -60,5 +60,15 @@ commons-lang commons-lang + + + + io.micrometer + micrometer-core + + + io.micrometer + micrometer-registry-prometheus + diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java index 7f556da690e..a965b4323dd 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java @@ -1,19 +1,17 @@ package com.ctrip.framework.apollo.common.controller; +import java.util.List; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.MimeMappings; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.PageRequest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; -import org.springframework.http.MediaType; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.List; - @Configuration public class WebMvcConfig implements WebMvcConfigurer, WebServerFactoryCustomizer { @@ -29,7 +27,6 @@ public void addArgumentResolvers(List argumentRes @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false); - configurer.ignoreAcceptHeader(true).defaultContentType(MediaType.APPLICATION_JSON_UTF8); } @Override diff --git a/apollo-common/src/main/resources/application.properties b/apollo-common/src/main/resources/application.properties index 27bdd5a6ee5..91f8ffcf837 100644 --- a/apollo-common/src/main/resources/application.properties +++ b/apollo-common/src/main/resources/application.properties @@ -17,3 +17,5 @@ server.max-http-header-size=10240 management.endpoints.web.base-path=/ logging.file.max-size=50MB logging.file.max-history=10 + +management.endpoints.web.exposure.include=info,health,metrics,prometheus diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java index 73d5403fea3..b3b07135051 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java @@ -271,7 +271,7 @@ protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() - .antMatchers("/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll() + .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll() .antMatchers("/**").hasAnyRole(USER_ROLE); http.formLogin().loginPage("/signin").permitAll().failureUrl("/signin?#/error").and().httpBasic(); SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); diff --git a/apollo-portal/src/main/resources/application.yml b/apollo-portal/src/main/resources/application.yml index a53e9525952..608871ba749 100644 --- a/apollo-portal/src/main/resources/application.yml +++ b/apollo-portal/src/main/resources/application.yml @@ -22,6 +22,6 @@ logging: management: health: status: - order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP + order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP