|
|
@ -17,8 +17,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
package com.tencent.cloud.common.metadata;
|
|
|
|
package com.tencent.cloud.common.metadata;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
@ -71,6 +74,7 @@ public class StaticMetadataManager {
|
|
|
|
private Map<String, String> configMetadata;
|
|
|
|
private Map<String, String> configMetadata;
|
|
|
|
private Map<String, String> configTransitiveMetadata;
|
|
|
|
private Map<String, String> configTransitiveMetadata;
|
|
|
|
private Map<String, String> configDisposableMetadata;
|
|
|
|
private Map<String, String> configDisposableMetadata;
|
|
|
|
|
|
|
|
private String configTransHeaders;
|
|
|
|
private Map<String, String> customSPIMetadata;
|
|
|
|
private Map<String, String> customSPIMetadata;
|
|
|
|
private Map<String, String> customSPITransitiveMetadata;
|
|
|
|
private Map<String, String> customSPITransitiveMetadata;
|
|
|
|
private Map<String, String> customSPIDisposableMetadata;
|
|
|
|
private Map<String, String> customSPIDisposableMetadata;
|
|
|
@ -162,6 +166,7 @@ public class StaticMetadataManager {
|
|
|
|
Map<String, String> allMetadata = metadataLocalProperties.getContent();
|
|
|
|
Map<String, String> allMetadata = metadataLocalProperties.getContent();
|
|
|
|
List<String> transitiveKeys = metadataLocalProperties.getTransitive();
|
|
|
|
List<String> transitiveKeys = metadataLocalProperties.getTransitive();
|
|
|
|
List<String> disposableKeys = metadataLocalProperties.getDisposable();
|
|
|
|
List<String> disposableKeys = metadataLocalProperties.getDisposable();
|
|
|
|
|
|
|
|
List<String> headers = metadataLocalProperties.getHeaders();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> transitiveResult = new HashMap<>();
|
|
|
|
Map<String, String> transitiveResult = new HashMap<>();
|
|
|
|
for (String key : transitiveKeys) {
|
|
|
|
for (String key : transitiveKeys) {
|
|
|
@ -179,6 +184,7 @@ public class StaticMetadataManager {
|
|
|
|
|
|
|
|
|
|
|
|
configTransitiveMetadata = Collections.unmodifiableMap(transitiveResult);
|
|
|
|
configTransitiveMetadata = Collections.unmodifiableMap(transitiveResult);
|
|
|
|
configDisposableMetadata = Collections.unmodifiableMap(disposableResult);
|
|
|
|
configDisposableMetadata = Collections.unmodifiableMap(disposableResult);
|
|
|
|
|
|
|
|
configTransHeaders = CollectionUtils.isEmpty(headers) ? null : String.join(",", headers);
|
|
|
|
configMetadata = Collections.unmodifiableMap(allMetadata);
|
|
|
|
configMetadata = Collections.unmodifiableMap(allMetadata);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -313,6 +319,29 @@ public class StaticMetadataManager {
|
|
|
|
return envNotReportMetadata.get(ENV_TRAFFIC_CONTENT_RAW_TRANSHEADERS);
|
|
|
|
return envNotReportMetadata.get(ENV_TRAFFIC_CONTENT_RAW_TRANSHEADERS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getTransHeaderFromConfig() {
|
|
|
|
|
|
|
|
return configTransHeaders;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getTransHeader() {
|
|
|
|
|
|
|
|
Set<String> transHeaderSet = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String transHeaderFromEnv = getTransHeaderFromEnv();
|
|
|
|
|
|
|
|
String transHeaderFromConfig = getTransHeaderFromConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set<String> transHeaderFromEnvSet = StringUtils.isNotBlank(transHeaderFromEnv)
|
|
|
|
|
|
|
|
? Arrays.stream(transHeaderFromEnv.split(",")).collect(Collectors.toSet())
|
|
|
|
|
|
|
|
: Collections.emptySet();
|
|
|
|
|
|
|
|
Set<String> transHeaderFromConfigSet = StringUtils.isNotBlank(transHeaderFromConfig)
|
|
|
|
|
|
|
|
? Arrays.stream(transHeaderFromConfig.split(",")).collect(Collectors.toSet())
|
|
|
|
|
|
|
|
: Collections.emptySet();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transHeaderSet.addAll(transHeaderFromEnvSet);
|
|
|
|
|
|
|
|
transHeaderSet.addAll(transHeaderFromConfigSet);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ArrayList<>(transHeaderSet).stream().sorted().collect(Collectors.joining(","));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, String> getEnvTransitiveMetadata() {
|
|
|
|
public Map<String, String> getEnvTransitiveMetadata() {
|
|
|
|
return envTransitiveMetadata;
|
|
|
|
return envTransitiveMetadata;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -390,6 +419,7 @@ public class StaticMetadataManager {
|
|
|
|
", envTransitiveMetadata=" + envTransitiveMetadata +
|
|
|
|
", envTransitiveMetadata=" + envTransitiveMetadata +
|
|
|
|
", configMetadata=" + configMetadata +
|
|
|
|
", configMetadata=" + configMetadata +
|
|
|
|
", configTransitiveMetadata=" + configTransitiveMetadata +
|
|
|
|
", configTransitiveMetadata=" + configTransitiveMetadata +
|
|
|
|
|
|
|
|
", configTransHeaders='" + configTransHeaders + '\'' +
|
|
|
|
", customSPIMetadata=" + customSPIMetadata +
|
|
|
|
", customSPIMetadata=" + customSPIMetadata +
|
|
|
|
", customSPITransitiveMetadata=" + customSPITransitiveMetadata +
|
|
|
|
", customSPITransitiveMetadata=" + customSPITransitiveMetadata +
|
|
|
|
", mergedStaticMetadata=" + mergedStaticMetadata +
|
|
|
|
", mergedStaticMetadata=" + mergedStaticMetadata +
|
|
|
|