Skip to content

Commit

Permalink
fix: adjustments according review
Browse files Browse the repository at this point in the history
  • Loading branch information
binarycoded committed Nov 26, 2024
1 parent ef1a7fa commit 7c560de
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

@SpringBootApplication
@ServletComponentScan
public class Application {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.NoArgsConstructor;
import rocks.inspectit.gepard.agentmanager.exception.MissingHeaderException;

/** Validation class that helps checking that all mandatory headers are set. */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ConfigurationRequestHeaderValidator {
public static void validateConfigurationRequestHeaders(Map<String, String> headers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class ConnectionService {
public static final String X_GEPARD_OTEL_VERSION = "x-gepard-otel-version";
public static final String X_GEPARD_JAVA_VERSION = "x-gepard-java-version";
public static final String X_GEPARD_START_TIME = "x-gepard-start-time";
public static final String X_GEPARD_ATTRIBUTE = "x-gepard-attribute-";

private final ConcurrentHashMap<String, Connection> connectionCache;
private final RegexQueryService regexQueryService;
Expand All @@ -40,6 +41,7 @@ public class ConnectionService {
*
* @param agentId The id of the agent to be connected.
* @param headers The request headers, which should contain the agent information.
* @return true if it is a new the connection, false if it is a reconnect
*/
public boolean handleConfigurationRequest(String agentId, Map<String, String> headers) {
boolean isNewRegistration;
Expand Down Expand Up @@ -223,13 +225,11 @@ private void connectAgent(String connectionId, Map<String, String> headers) {

Map<String, String> attributes =
headers.entrySet().stream()
.filter(entry -> entry.getKey().startsWith("x-gepard-attribute-"))
.filter(entry -> entry.getKey().startsWith(X_GEPARD_ATTRIBUTE))
.collect(
Collectors.toMap(
entry ->
entry
.getKey()
.substring("x-gepard-attribute-".length()), // remove the prefix
entry.getKey().substring(X_GEPARD_ATTRIBUTE.length()), // remove the prefix
Map.Entry::getValue));

Agent agent =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static HttpHeaders getGepardHeaders() {
headers.add(X_GEPARD_OTEL_VERSION, "test-otel-version");
headers.add(X_GEPARD_JAVA_VERSION, "test-java-version");
headers.add(X_GEPARD_START_TIME, Instant.now().toString());
headers.add("x-gepard-attribute-test-attribute", "test-attribute-value");
headers.add(X_GEPARD_ATTRIBUTE + "test-attribute", "test-attribute-value");
return headers;
}
}
3 changes: 0 additions & 3 deletions frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ tasks.register('package_frontend', Jar) {
// Task to build the frontend
npm_run_build {

// First clean the dist and build directory
// dependsOn clean

// Only execute this task if something in the frontend has changed.
inputs.files fileTree('src')
inputs.files fileTree('public')
Expand Down

0 comments on commit 7c560de

Please sign in to comment.