Skip to content

Commit cbabaa1

Browse files
authored
Remove view file config mechanism (#8394)
1 parent 83f947f commit cbabaa1

15 files changed

Lines changed: 0 additions & 1068 deletions

File tree

sdk-extensions/incubator/README.md

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,99 +6,3 @@ This artifact contains experimental code related to the trace and metric SDKs.
66

77
> [!WARNING]
88
> Relocated to [opentelemetry-sdk-extensions-declarative-config](../declarative-config)
9-
10-
## View File Configuration
11-
12-
> [!WARNING]
13-
> 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.
14-
15-
Adds support for file based YAML configuration of Metric SDK Views.
16-
17-
For example, suppose `/Users/user123/view.yaml` has the following content:
18-
19-
```yaml
20-
- selector:
21-
instrument_name: my-instrument
22-
instrument_type: COUNTER
23-
instrument_unit: ms
24-
meter_name: my-meter
25-
meter_version: 1.0.0
26-
meter_schema_url: http://example.com
27-
view:
28-
name: new-instrument-name
29-
description: new-description
30-
aggregation: explicit_bucket_histogram
31-
aggregation_args:
32-
bucket_boundaries: [1.0, 2.0, 5.0]
33-
attribute_keys:
34-
- foo
35-
- bar
36-
```
37-
38-
The equivalent view configuration would be:
39-
40-
```
41-
SdkMeterProvider.builder()
42-
.registerView(
43-
InstrumentSelector.builder()
44-
.setName("my-instrument")
45-
.setType(InstrumentType.COUNTER)
46-
.setUnit("ms")
47-
.setMeterName("my-meter")
48-
.setMeterVersion("1.0.0")
49-
.setMeterSchemaUrl("http://example.com")
50-
.build(),
51-
View.builder()
52-
.setName("new-instrument")
53-
.setDescription("new-description")
54-
.setAggregation(Aggregation.explicitBucketHistogram(Arrays.asList(1.0, 2.0, 5.0))
55-
.setAttributesFilter(key -> new HashSet<>(Arrays.asList("foo", "bar")).contains(key))
56-
.build());
57-
```
58-
59-
If using [autoconfigure](../autoconfigure) with this artifact on your classpath, it will automatically load a list of view config files specified via environment variable or system property:
60-
61-
| System property | Environment variable | Purpose |
62-
|---------------------------------------|---------------------------------------|------------------------------------------------------|
63-
| otel.experimental.metrics.view-config | OTEL_EXPERIMENTAL_METRICS_VIEW_CONFIG | List of files containing view configuration YAML [1] |
64-
65-
**[1]** In addition to absolute paths, resources on the classpath packaged with a jar can be loaded.
66-
For example, `otel.experimental.metrics.view-config=classpath:/my-view.yaml` loads the
67-
resource `/my-view.yaml`.
68-
69-
If not using autoconfigure, a file can be used to configure views as follows:
70-
71-
```
72-
SdkMeterProviderBuilder builder = SdkMeterProvider.builder();
73-
try (FileInputStream fileInputStream = new FileInputStream("/Users/user123/view.yaml")) {
74-
ViewConfig.registerViews(builder, fileInputStream);
75-
}
76-
```
77-
78-
The following table describes the set of recognized aggregations:
79-
80-
| Aggregation | Arguments |
81-
|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
82-
| [`default`] | - |
83-
| [`sum`] | - |
84-
| [`last_value`] | - |
85-
| [`drop`] | - |
86-
| [`explicit_bucket_histogram`] | `bucket_boundaries` (optional): List of inclusive upper boundaries for the histogram buckets, in order from lowest to highest. |
87-
| [`exponential_bucket_histogram`] | `max_buckets` (optional): The maximum number of buckets to use for positive or negative recordings. |
88-
89-
Additional notes on usage:
90-
91-
- Many view configurations can live in one file. The YAML is parsed as an array of view
92-
configurations.
93-
- At least one selection field is required, but including all is not necessary. Any omitted fields
94-
will result in the default from `InstrumentSelector` being used.
95-
- At least one view field is required, but including all is not required. Any omitted fields will
96-
result in the default from `View` being used.
97-
- Instrument name selection supports the following wildcard characters: `*` matches 0 or more instances of any character; `?` matches exactly one instance of any character. No other advanced selection criteria is supported.
98-
99-
[`default`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#default-aggregation
100-
[`sum`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#sum-aggregation
101-
[`last_value`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#last-value-aggregation
102-
[`drop`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#drop-aggregation
103-
[`explicit_bucket_histogram`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation
104-
[`exponential_bucket_histogram`]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#base2-exponential-bucket-histogram-aggregation

sdk-extensions/incubator/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ dependencies {
1717

1818
compileOnly(project(":api:incubator"))
1919

20-
// io.opentelemetry.sdk.extension.incubator.metric.viewconfig
2120
implementation(project(":sdk-extensions:autoconfigure-spi"))
22-
implementation("org.snakeyaml:snakeyaml-engine")
2321

2422
testImplementation(project(":sdk:testing"))
2523
testImplementation(project(":sdk-extensions:autoconfigure"))

sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/metric/viewconfig/SelectorSpecification.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)