File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed
baggage-processor/src/test/java/io/opentelemetry/contrib/baggage/processor Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright The OpenTelemetry Authors
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ package io .opentelemetry .contrib .baggage .processor ;
7+
8+ import static org .assertj .core .api .Assertions .assertThat ;
9+
10+ import io .opentelemetry .sdk .OpenTelemetrySdk ;
11+ import io .opentelemetry .sdk .extension .incubator .fileconfig .DeclarativeConfiguration ;
12+ import java .io .ByteArrayInputStream ;
13+ import java .nio .charset .StandardCharsets ;
14+ import org .junit .jupiter .api .Test ;
15+
16+ class BaggageLogRecordComponentProviderTest {
17+
18+ @ Test
19+ void declarativeConfig () {
20+ String yaml =
21+ "file_format: 0.4\n "
22+ + "logger_provider:\n "
23+ + " processors:\n "
24+ + " - baggage:\n "
25+ + " included: [foo]\n "
26+ + " excluded: [bar]\n " ;
27+
28+ OpenTelemetrySdk sdk =
29+ DeclarativeConfiguration .parseAndCreate (
30+ new ByteArrayInputStream (yaml .getBytes (StandardCharsets .UTF_8 )));
31+
32+ assertThat (sdk ).asString ().contains ("BaggageLogRecordProcessor" );
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright The OpenTelemetry Authors
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ package io .opentelemetry .contrib .baggage .processor ;
7+
8+ import static org .assertj .core .api .Assertions .assertThat ;
9+
10+ import io .opentelemetry .sdk .OpenTelemetrySdk ;
11+ import io .opentelemetry .sdk .extension .incubator .fileconfig .DeclarativeConfiguration ;
12+ import java .io .ByteArrayInputStream ;
13+ import java .nio .charset .StandardCharsets ;
14+ import org .junit .jupiter .api .Test ;
15+
16+ class BaggageSpanComponentProviderTest {
17+
18+ @ Test
19+ void declarativeConfig () {
20+ String yaml =
21+ "file_format: 0.4\n "
22+ + "tracer_provider:\n "
23+ + " processors:\n "
24+ + " - baggage:\n "
25+ + " included: [foo]\n "
26+ + " excluded: [bar]\n " ;
27+
28+ OpenTelemetrySdk sdk =
29+ DeclarativeConfiguration .parseAndCreate (
30+ new ByteArrayInputStream (yaml .getBytes (StandardCharsets .UTF_8 )));
31+
32+ assertThat (sdk ).asString ().contains ("BaggageSpanProcessor" );
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments