Skip to content

Commit 28d8cf9

Browse files
authored
Add files to expose the currently used external types. (#1303)
To get ready for release candidate, we should keep track of these as it affects how stable we can consider being. Add check to CI.
1 parent aa586cb commit 28d8cf9

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ jobs:
4848
args: --all -- --check
4949
- name: Lint
5050
run: ./scripts/lint.sh
51+
external-types:
52+
strategy:
53+
matrix:
54+
example: [opentelemetry, opentelemetry-sdk]
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: actions-rs/toolchain@v1
59+
with:
60+
toolchain: nightly
61+
components: rustfmt
62+
override: true
63+
- name: external-type-check
64+
run: |
65+
cargo install cargo-check-external-types
66+
cd ${{ matrix.example }}
67+
cargo check-external-types --config allowed-external-types.toml
5168
non-default-examples:
5269
strategy:
5370
matrix:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
4+
# the public API. Ideally this can have a few exceptions as possible.
5+
allowed_external_types = [
6+
"opentelemetry::*",
7+
"async_channel::Receiver",
8+
"async_channel::Sender",
9+
"async_std::stream::interval::Interval",
10+
"futures_channel::oneshot::Sender", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
11+
"futures_core::future::BoxFuture", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
12+
"futures_core::stream::Stream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
13+
"opentelemetry_http::HttpClient", # TODO: We probably shouldn't be depending on another SDK not in the API from the SDK.
14+
"tokio_stream::wrappers::interval::IntervalStream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
15+
"tokio_stream::wrappers::mpsc_bounded::ReceiverStream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
16+
"tokio::sync::mpsc::bounded::Sender",
17+
"tokio::time::sleep::Sleep",
18+
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
4+
# the public API. Ideally this can have a few exceptions as possible.
5+
allowed_external_types = [
6+
"indexmap::map::core::Entry",
7+
"indexmap::map::iter::Drain",
8+
"indexmap::map::iter::IterMut",
9+
"indexmap::map::iter::Iter",
10+
"indexmap::map::iter::IntoIter",
11+
"indexmap::map::iter::IntoKeys",
12+
"indexmap::map::iter::Keys",
13+
"indexmap::map::iter::IntoValues",
14+
"indexmap::map::iter::Values",
15+
"indexmap::map::iter::ValuesMut",
16+
"equivalent::Equivalent",
17+
"futures_sink::Sink", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
18+
"futures_core::stream::Stream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
19+
]

0 commit comments

Comments
 (0)