Skip to content

Commit bfa9a9b

Browse files
committed
pr review
1 parent ee273eb commit bfa9a9b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/internal/DeclarativeConfigPropertiesBridge.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ final class DeclarativeConfigPropertiesBridge implements ConfigProperties {
5656
@Nullable private final DeclarativeConfigProperties baseNode;
5757

5858
// lookup order matters - we choose the first match
59-
private final Map<String, String> translationMap;
59+
private final Map<String, String> mappings;
6060
private final Map<String, Object> overrideValues;
6161

6262
DeclarativeConfigPropertiesBridge(
6363
@Nullable DeclarativeConfigProperties baseNode,
64-
Map<String, String> translationMap,
64+
Map<String, String> mappings,
6565
Map<String, Object> overrideValues) {
6666
this.baseNode = baseNode;
67-
this.translationMap = translationMap;
67+
this.mappings = mappings;
6868
this.overrideValues = overrideValues;
6969
}
7070

@@ -205,7 +205,7 @@ private static String[] getSegments(String property) {
205205
}
206206

207207
private String translateProperty(String property) {
208-
for (Map.Entry<String, String> entry : translationMap.entrySet()) {
208+
for (Map.Entry<String, String> entry : mappings.entrySet()) {
209209
if (property.startsWith(entry.getKey())) {
210210
return entry.getValue() + property.substring(entry.getKey().length());
211211
}

javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/internal/DeclarativeConfigPropertiesBridgeBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
* at any time.
2626
*/
2727
public class DeclarativeConfigPropertiesBridgeBuilder {
28-
private final LinkedHashMap<String, String> translationMap = new LinkedHashMap<>();
28+
private final LinkedHashMap<String, String> mappings = new LinkedHashMap<>();
2929
private final Map<String, Object> overrideValues = new LinkedHashMap<>();
3030

3131
public DeclarativeConfigPropertiesBridgeBuilder() {}
3232

3333
/**
34-
* Adds a translation from a property prefix to a YAML path.
34+
* Adds a mapping from a property prefix to a YAML path.
3535
*
3636
* <p>For example, if the property prefix is "otel.javaagent" and the YAML path is "agent", then
3737
* any property starting with "otel.javaagent." will be resolved against the "agent" node in the
@@ -41,9 +41,9 @@ public DeclarativeConfigPropertiesBridgeBuilder() {}
4141
* @param yamlPath the YAML path to resolve the property against
4242
*/
4343
@CanIgnoreReturnValue
44-
public DeclarativeConfigPropertiesBridgeBuilder addTranslation(
44+
public DeclarativeConfigPropertiesBridgeBuilder addMapping(
4545
String propertyPrefix, String yamlPath) {
46-
translationMap.put(propertyPrefix, yamlPath);
46+
mappings.put(propertyPrefix, yamlPath);
4747
return this;
4848
}
4949

@@ -95,6 +95,6 @@ public ConfigProperties buildFromInstrumentationConfig(
9595
instrumentationConfig = DeclarativeConfigProperties.empty();
9696
}
9797
return new DeclarativeConfigPropertiesBridge(
98-
instrumentationConfig.getStructured("java", empty()), translationMap, overrideValues);
98+
instrumentationConfig.getStructured("java", empty()), mappings, overrideValues);
9999
}
100100
}

javaagent-extension-api/src/test/java/io/opentelemetry/javaagent/extension/internal/DeclarativeConfigPropertiesBridgeTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void vendorTranslation() {
126126
ConfigProperties propertiesBridge =
127127
create(
128128
new DeclarativeConfigPropertiesBridgeBuilder()
129-
.addTranslation("acme", "acme.full_name"));
129+
.addMapping("acme", "acme.full_name"));
130130
assertThat(propertiesBridge.getBoolean("acme.preserved")).isTrue();
131131
}
132132

@@ -135,7 +135,7 @@ void agentCommonTranslation() {
135135
assertThat(
136136
create(
137137
new DeclarativeConfigPropertiesBridgeBuilder()
138-
.addTranslation(
138+
.addMapping(
139139
"otel.instrumentation.common.default-enabled",
140140
"common.default.enabled"))
141141
.getBoolean("otel.instrumentation.common.default-enabled"))
@@ -147,7 +147,7 @@ void agentTranslation() {
147147
ConfigProperties bridge =
148148
create(
149149
new DeclarativeConfigPropertiesBridgeBuilder()
150-
.addTranslation("otel.javaagent", "agent")
150+
.addMapping("otel.javaagent", "agent")
151151
.addOverride("otel.javaagent.debug", true)
152152
.addOverride("otel.javaagent.logging", "application"));
153153

javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/OpenTelemetryInstaller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public static AutoConfiguredOpenTelemetrySdk installOpenTelemetrySdk(
4848
// so this is functionally equivalent
4949
Resource.getDefault(),
5050
new DeclarativeConfigPropertiesBridgeBuilder()
51-
.addTranslation(
51+
.addMapping(
5252
"otel.instrumentation.common.default-enabled", "common.default.enabled")
53-
.addTranslation("otel.javaagent", "agent")
53+
.addMapping("otel.javaagent", "agent")
5454
// these properties are used to initialize the SDK before the configuration file
5555
// is loaded for consistency, we pass them to the bridge, so that they can be read
5656
// later with the same value from the {@link DeclarativeConfigPropertiesBridge}

0 commit comments

Comments
 (0)