Skip to content

Commit

Permalink
patch server-UI and TagValueGuard (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddeCCC authored Dec 14, 2023
1 parent 7991402 commit dd8dbf0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package rocks.inspectit.ocelot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
Expand All @@ -16,4 +18,14 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
.addResourceHandler("/ui/**")
.addResourceLocations("classpath:/static/ui/");
}

@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController("/ui", "/ui/")
.setKeepQueryParams(true)
.setStatusCode(HttpStatus.PERMANENT_REDIRECT);
registry.addRedirectViewController("/", "/ui/")
.setKeepQueryParams(true)
.setStatusCode(HttpStatus.PERMANENT_REDIRECT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ spring:
# server properties - see https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#server-properties
server:
port: 8090
max-http-header-size: 1MB

inspectit-config-server:
# the directory which is used as working directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ protected void stop() {
Set<String> tagValues = tagValuesByTagKey.computeIfAbsent(tagKey, (x) -> new HashSet<>());
// if tag value is new AND max values per tag is already reached
if (!tagValues.contains(tagValue) && tagValues.size() >= maxValuesPerTag) {
blockedTagKeysByMeasure.computeIfAbsent(measureName, measure -> Sets.newHashSet()).add(tagKey);
agentHealthManager.handleInvalidatableHealth(AgentHealth.ERROR, this.getClass(),
String.format(tagOverFlowMessageTemplate, measureName, tagKey));
hasTagValueOverflow = true;
boolean isNewBlockedTag = blockedTagKeysByMeasure.computeIfAbsent(measureName, measure -> Sets.newHashSet()).add(tagKey);
if(isNewBlockedTag) {
agentHealthManager.handleInvalidatableHealth(AgentHealth.ERROR, this.getClass(),
String.format(tagOverFlowMessageTemplate, measureName, tagKey));
hasTagValueOverflow = true;
}
} else {
tagValues.add(tagValue);
}
Expand Down

0 comments on commit dd8dbf0

Please sign in to comment.