Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk-extensions/incubator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Notes:

## View File Configuration

> [!WARNING]
> This mechanism is superseded by declarative config, which is now stable (spec and schema at [opentelemetry-configuration](https://github.com/open-telemetry/opentelemetry-configuration)) and will be removed after the 1.62.0 release. Please use [declarative configuration](#declarative-configuration) instead.

Adds support for file based YAML configuration of Metric SDK Views.

For example, suppose `/Users/user123/view.yaml` has the following content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@
* .setAttributesFilter(key -> new HashSet<>(Arrays.asList("foo", "bar")).contains(key))
* .build());
* }</pre>
*
* @deprecated this mechanism is superseded by declarative config, which is now stable (spec and
* schema at <a
* href="https://github.com/open-telemetry/opentelemetry-configuration">opentelemetry-configuration</a>.
* Please uses {@link
* io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration#parseAndCreate(InputStream)}
* instead.
*/
@Deprecated
public final class ViewConfig {

private ViewConfig() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.logging.Logger;

/** SPI implementation for loading view configuration YAML. */
/**
* SPI implementation for loading view configuration YAML.
*
* @deprecated this mechanism is superseded by declarative config, which is now stable (spec and
* schema at <a
* href="https://github.com/open-telemetry/opentelemetry-configuration">opentelemetry-configuration</a>)
* and will be removed after the 1.62.0 release. Please uses {@link
* io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration#parseAndCreate(InputStream)}
* instead.
*/
@Deprecated
public final class ViewConfigCustomizer implements AutoConfigurationCustomizerProvider {
private static final Logger LOGGER = Logger.getLogger(ViewConfigCustomizer.class.getName());

@Override
public void customize(AutoConfigurationCustomizer autoConfiguration) {
Expand All @@ -29,6 +41,10 @@ static SdkMeterProviderBuilder customizeMeterProvider(
SdkMeterProviderBuilder meterProviderBuilder, ConfigProperties configProperties) {
List<String> configFileLocations =
configProperties.getList("otel.experimental.metrics.view.config");
if (!configFileLocations.isEmpty()) {
LOGGER.warning(
"otel.experimental.metrics.view.config is deprecated and will be removed after 1.62 release. Please use declarative config instead.");
}
for (String configFileLocation : configFileLocations) {
if (configFileLocation.startsWith("classpath:")) {
String classpathLocation = configFileLocation.substring("classpath:".length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.UUID;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // Testing deprecated methods
class ViewConfigCustomizerTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;

@SuppressWarnings("deprecation") // Testing deprecated methods
class ViewConfigTest {

@Test
Expand Down
Loading