Skip to content

Commit 0389e1c

Browse files
committed
Rename to declarative configuration
1 parent e986018 commit 0389e1c

File tree

58 files changed

+361
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+361
-352
lines changed

api/incubator/src/main/java/io/opentelemetry/api/incubator/config/ConfigProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import javax.annotation.concurrent.ThreadSafe;
1010

1111
/**
12-
* A registry for accessing configuration.
12+
* A registry for accessing declarative configuration.
1313
*
1414
* <p>The name <i>Provider</i> is for consistency with other languages and it is <b>NOT</b> loaded
1515
* using reflection.
@@ -21,14 +21,14 @@
2121
public interface ConfigProvider {
2222

2323
/**
24-
* Returns the {@link StructuredConfigProperties} corresponding to <a
24+
* Returns the {@link DeclarativeConfigProperties} corresponding to <a
2525
* href="https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema/instrumentation.json">instrumentation
2626
* config</a>, or {@code null} if unavailable.
2727
*
28-
* @return the instrumentation {@link StructuredConfigProperties}
28+
* @return the instrumentation {@link DeclarativeConfigProperties}
2929
*/
3030
@Nullable
31-
StructuredConfigProperties getInstrumentationConfig();
31+
DeclarativeConfigProperties getInstrumentationConfig();
3232

3333
/** Returns a no-op {@link ConfigProvider}. */
3434
static ConfigProvider noop() {

api/incubator/src/main/java/io/opentelemetry/api/incubator/config/StructuredConfigException.java renamed to api/incubator/src/main/java/io/opentelemetry/api/incubator/config/DeclarativeConfigException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
package io.opentelemetry.api.incubator.config;
77

8-
/** An exception that is thrown if the user-provided file configuration is invalid. */
9-
public final class StructuredConfigException extends RuntimeException {
8+
/** An exception that is thrown when errors occur with declarative configuration. */
9+
public final class DeclarativeConfigException extends RuntimeException {
1010

1111
private static final long serialVersionUID = 3036584181551130522L;
1212

1313
/** Create a new configuration exception with specified {@code message} and without a cause. */
14-
public StructuredConfigException(String message) {
14+
public DeclarativeConfigException(String message) {
1515
super(message);
1616
}
1717

1818
/** Create a new configuration exception with specified {@code message} and {@code cause}. */
19-
public StructuredConfigException(String message, Throwable cause) {
19+
public DeclarativeConfigException(String message, Throwable cause) {
2020
super(message, cause);
2121
}
2222
}

api/incubator/src/main/java/io/opentelemetry/api/incubator/config/StructuredConfigProperties.java renamed to api/incubator/src/main/java/io/opentelemetry/api/incubator/config/DeclarativeConfigProperties.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
import javax.annotation.Nullable;
1313

1414
/**
15-
* An interface for accessing structured configuration data.
15+
* An interface for accessing declarative configuration data.
1616
*
17-
* <p>An instance of {@link StructuredConfigProperties} is equivalent to a <a
17+
* <p>An instance of {@link DeclarativeConfigProperties} is equivalent to a <a
1818
* href="https://yaml.org/spec/1.2.2/#3211-nodes">YAML mapping node</a>. It has accessors for
1919
* reading scalar properties, {@link #getStructured(String)} for reading children which are
2020
* themselves mappings, and {@link #getStructuredList(String)} for reading children which are
2121
* sequences of mappings.
2222
*/
23-
public interface StructuredConfigProperties {
23+
public interface DeclarativeConfigProperties {
2424

2525
/**
2626
* Returns a {@link String} configuration property.
2727
*
2828
* @return null if the property has not been configured
29-
* @throws StructuredConfigException if the property is not a valid scalar string
29+
* @throws DeclarativeConfigException if the property is not a valid scalar string
3030
*/
3131
@Nullable
3232
String getString(String name);
@@ -36,7 +36,7 @@ public interface StructuredConfigProperties {
3636
*
3737
* @return a {@link String} configuration property or {@code defaultValue} if a property with
3838
* {@code name} has not been configured
39-
* @throws StructuredConfigException if the property is not a valid scalar string
39+
* @throws DeclarativeConfigException if the property is not a valid scalar string
4040
*/
4141
default String getString(String name, String defaultValue) {
4242
return defaultIfNull(getString(name), defaultValue);
@@ -47,7 +47,7 @@ default String getString(String name, String defaultValue) {
4747
* {@link Boolean#parseBoolean(String)} for handling the values.
4848
*
4949
* @return null if the property has not been configured
50-
* @throws StructuredConfigException if the property is not a valid scalar boolean
50+
* @throws DeclarativeConfigException if the property is not a valid scalar boolean
5151
*/
5252
@Nullable
5353
Boolean getBoolean(String name);
@@ -57,7 +57,7 @@ default String getString(String name, String defaultValue) {
5757
*
5858
* @return a {@link Boolean} configuration property or {@code defaultValue} if a property with
5959
* {@code name} has not been configured
60-
* @throws StructuredConfigException if the property is not a valid scalar boolean
60+
* @throws DeclarativeConfigException if the property is not a valid scalar boolean
6161
*/
6262
default boolean getBoolean(String name, boolean defaultValue) {
6363
return defaultIfNull(getBoolean(name), defaultValue);
@@ -70,7 +70,7 @@ default boolean getBoolean(String name, boolean defaultValue) {
7070
* {@link Long#intValue()} which may result in loss of precision.
7171
*
7272
* @return null if the property has not been configured
73-
* @throws StructuredConfigException if the property is not a valid scalar integer
73+
* @throws DeclarativeConfigException if the property is not a valid scalar integer
7474
*/
7575
@Nullable
7676
Integer getInt(String name);
@@ -83,7 +83,7 @@ default boolean getBoolean(String name, boolean defaultValue) {
8383
*
8484
* @return a {@link Integer} configuration property or {@code defaultValue} if a property with
8585
* {@code name} has not been configured
86-
* @throws StructuredConfigException if the property is not a valid scalar integer
86+
* @throws DeclarativeConfigException if the property is not a valid scalar integer
8787
*/
8888
default int getInt(String name, int defaultValue) {
8989
return defaultIfNull(getInt(name), defaultValue);
@@ -93,7 +93,7 @@ default int getInt(String name, int defaultValue) {
9393
* Returns a {@link Long} configuration property.
9494
*
9595
* @return null if the property has not been configured
96-
* @throws StructuredConfigException if the property is not a valid scalar long
96+
* @throws DeclarativeConfigException if the property is not a valid scalar long
9797
*/
9898
@Nullable
9999
Long getLong(String name);
@@ -103,7 +103,7 @@ default int getInt(String name, int defaultValue) {
103103
*
104104
* @return a {@link Long} configuration property or {@code defaultValue} if a property with {@code
105105
* name} has not been configured
106-
* @throws StructuredConfigException if the property is not a valid scalar long
106+
* @throws DeclarativeConfigException if the property is not a valid scalar long
107107
*/
108108
default long getLong(String name, long defaultValue) {
109109
return defaultIfNull(getLong(name), defaultValue);
@@ -113,7 +113,7 @@ default long getLong(String name, long defaultValue) {
113113
* Returns a {@link Double} configuration property.
114114
*
115115
* @return null if the property has not been configured
116-
* @throws StructuredConfigException if the property is not a valid scalar double
116+
* @throws DeclarativeConfigException if the property is not a valid scalar double
117117
*/
118118
@Nullable
119119
Double getDouble(String name);
@@ -123,7 +123,7 @@ default long getLong(String name, long defaultValue) {
123123
*
124124
* @return a {@link Double} configuration property or {@code defaultValue} if a property with
125125
* {@code name} has not been configured
126-
* @throws StructuredConfigException if the property is not a valid scalar double
126+
* @throws DeclarativeConfigException if the property is not a valid scalar double
127127
*/
128128
default double getDouble(String name, double defaultValue) {
129129
return defaultIfNull(getDouble(name), defaultValue);
@@ -137,7 +137,7 @@ default double getDouble(String name, double defaultValue) {
137137
* @param scalarType the scalar type, one of {@link String}, {@link Boolean}, {@link Long} or
138138
* {@link Double}
139139
* @return a {@link List} configuration property, or null if the property has not been configured
140-
* @throws StructuredConfigException if the property is not a valid sequence of scalars, or if
140+
* @throws DeclarativeConfigException if the property is not a valid sequence of scalars, or if
141141
* {@code scalarType} is not supported
142142
*/
143143
@Nullable
@@ -152,31 +152,31 @@ default double getDouble(String name, double defaultValue) {
152152
* {@link Double}
153153
* @return a {@link List} configuration property or {@code defaultValue} if a property with {@code
154154
* name} has not been configured
155-
* @throws StructuredConfigException if the property is not a valid sequence of scalars
155+
* @throws DeclarativeConfigException if the property is not a valid sequence of scalars
156156
*/
157157
default <T> List<T> getScalarList(String name, Class<T> scalarType, List<T> defaultValue) {
158158
return defaultIfNull(getScalarList(name, scalarType), defaultValue);
159159
}
160160

161161
/**
162-
* Returns a {@link StructuredConfigProperties} configuration property.
162+
* Returns a {@link DeclarativeConfigProperties} configuration property.
163163
*
164164
* @return a map-valued configuration property, or {@code null} if {@code name} has not been
165165
* configured
166-
* @throws StructuredConfigException if the property is not a mapping
166+
* @throws DeclarativeConfigException if the property is not a mapping
167167
*/
168168
@Nullable
169-
StructuredConfigProperties getStructured(String name);
169+
DeclarativeConfigProperties getStructured(String name);
170170

171171
/**
172-
* Returns a list of {@link StructuredConfigProperties} configuration property.
172+
* Returns a list of {@link DeclarativeConfigProperties} configuration property.
173173
*
174174
* @return a list of map-valued configuration property, or {@code null} if {@code name} has not
175175
* been configured
176-
* @throws StructuredConfigException if the property is not a sequence of mappings
176+
* @throws DeclarativeConfigException if the property is not a sequence of mappings
177177
*/
178178
@Nullable
179-
List<StructuredConfigProperties> getStructuredList(String name);
179+
List<DeclarativeConfigProperties> getStructuredList(String name);
180180

181181
/**
182182
* Returns a set of all configuration property keys.

api/incubator/src/main/java/io/opentelemetry/api/incubator/config/GlobalConfigProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import javax.annotation.Nullable;
1111

1212
/**
13-
* This class provides a temporary global accessor for {@link ConfigProvider} until the config API
14-
* is marked stable. It will eventually be merged into {@link GlobalOpenTelemetry}.
13+
* This class provides a temporary global accessor for {@link ConfigProvider} until the
14+
* instrumentation config API is marked stable. It will eventually be merged into {@link
15+
* GlobalOpenTelemetry}.
1516
*/
1617
// We intentionally assign to be used for error reporting.
1718
@SuppressWarnings("StaticAssignmentOfThrowable")

api/incubator/src/main/java/io/opentelemetry/api/incubator/config/InstrumentationConfigUtil.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public class InstrumentationConfigUtil {
2323
* Return a map representation of the peer service map entries in {@code
2424
* .instrumentation.general.peer.service_mapping}, or null if none is configured.
2525
*
26-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
26+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
2727
*/
2828
@Nullable
2929
public static Map<String, String> peerServiceMapping(ConfigProvider configProvider) {
30-
Optional<List<StructuredConfigProperties>> optServiceMappingList =
30+
Optional<List<DeclarativeConfigProperties>> optServiceMappingList =
3131
Optional.ofNullable(configProvider.getInstrumentationConfig())
3232
.map(instrumentationConfig -> instrumentationConfig.getStructured("general"))
3333
.map(generalConfig -> generalConfig.getStructured("peer"))
@@ -53,7 +53,7 @@ public static Map<String, String> peerServiceMapping(ConfigProvider configProvid
5353
* Return {@code .instrumentation.general.http.client.request_captured_headers}, or null if none
5454
* is configured.
5555
*
56-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
56+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
5757
*/
5858
@Nullable
5959
public static List<String> httpClientRequestCapturedHeaders(ConfigProvider configProvider) {
@@ -70,7 +70,7 @@ public static List<String> httpClientRequestCapturedHeaders(ConfigProvider confi
7070
* Return {@code .instrumentation.general.http.client.response_captured_headers}, or null if none
7171
* is configured.
7272
*
73-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
73+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
7474
*/
7575
@Nullable
7676
public static List<String> httpClientResponseCapturedHeaders(ConfigProvider configProvider) {
@@ -87,7 +87,7 @@ public static List<String> httpClientResponseCapturedHeaders(ConfigProvider conf
8787
* Return {@code .instrumentation.general.http.server.request_captured_headers}, or null if none
8888
* is configured.
8989
*
90-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
90+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
9191
*/
9292
@Nullable
9393
public static List<String> httpServerRequestCapturedHeaders(ConfigProvider configProvider) {
@@ -104,7 +104,7 @@ public static List<String> httpServerRequestCapturedHeaders(ConfigProvider confi
104104
* Return {@code .instrumentation.general.http.server.response_captured_headers}, or null if none
105105
* is configured.
106106
*
107-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
107+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
108108
*/
109109
@Nullable
110110
public static List<String> httpSeverResponseCapturedHeaders(ConfigProvider configProvider) {
@@ -120,10 +120,10 @@ public static List<String> httpSeverResponseCapturedHeaders(ConfigProvider confi
120120
/**
121121
* Return {@code .instrumentation.java.<instrumentationName>}, or null if none is configured.
122122
*
123-
* @throws StructuredConfigException if an unexpected type is encountered accessing the property
123+
* @throws DeclarativeConfigException if an unexpected type is encountered accessing the property
124124
*/
125125
@Nullable
126-
public static StructuredConfigProperties javaInstrumentationConfig(
126+
public static DeclarativeConfigProperties javaInstrumentationConfig(
127127
ConfigProvider configProvider, String instrumentationName) {
128128
return Optional.ofNullable(configProvider.getInstrumentationConfig())
129129
.map(instrumentationConfig -> instrumentationConfig.getStructured("java"))

0 commit comments

Comments
 (0)