Skip to content

Commit 190720d

Browse files
authored
Special handling for invalid global labels for APM agent (#120795)
1 parent 83dd34f commit 190720d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/apm/src/main/java/org/elasticsearch/telemetry/apm/internal/APMAgentSettings.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public void initAgentSystemProperties(Settings settings) {
9090
*/
9191
@SuppressForbidden(reason = "Need to be able to manipulate APM agent-related properties to set them dynamically")
9292
public void setAgentSetting(String key, String value) {
93+
if (key.startsWith("global_labels.")) {
94+
// Invalid agent setting, leftover from flattening global labels in APMJVMOptions
95+
// https://github.com/elastic/elasticsearch/issues/120791
96+
return;
97+
}
9398
final String completeKey = "elastic.apm." + Objects.requireNonNull(key);
9499
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
95100
if (value == null || value.isEmpty()) {
@@ -242,8 +247,8 @@ private static Setting<String> concreteAgentSetting(String namespace, String qua
242247
return new Setting<>(qualifiedKey, "", (value) -> {
243248
if (qualifiedKey.equals("_na_") == false && PERMITTED_AGENT_KEYS.contains(namespace) == false) {
244249
if (namespace.startsWith("global_labels.")) {
245-
// The nested labels syntax is transformed in APMJvmOptions.
246-
// Ignore these here to not fail if not correctly removed.
250+
// Invalid agent setting, leftover from flattening global labels in APMJVMOptions
251+
// https://github.com/elastic/elasticsearch/issues/120791
247252
return value;
248253
}
249254
throw new IllegalArgumentException("Configuration [" + qualifiedKey + "] is either prohibited or unknown.");

0 commit comments

Comments
 (0)