Skip to content

Commit

Permalink
Add files to expose the currently used external types. (#1303)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hdost committed Oct 23, 2023
1 parent aa586cb commit 28d8cf9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ jobs:
args: --all -- --check
- name: Lint
run: ./scripts/lint.sh
external-types:
strategy:
matrix:
example: [opentelemetry, opentelemetry-sdk]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt
override: true
- name: external-type-check
run: |
cargo install cargo-check-external-types
cd ${{ matrix.example }}
cargo check-external-types --config allowed-external-types.toml
non-default-examples:
strategy:
matrix:
Expand Down
18 changes: 18 additions & 0 deletions opentelemetry-sdk/allowed-external-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
# the public API. Ideally this can have a few exceptions as possible.
allowed_external_types = [
"opentelemetry::*",
"async_channel::Receiver",
"async_channel::Sender",
"async_std::stream::interval::Interval",
"futures_channel::oneshot::Sender", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
"futures_core::future::BoxFuture", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
"futures_core::stream::Stream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
"opentelemetry_http::HttpClient", # TODO: We probably shouldn't be depending on another SDK not in the API from the SDK.
"tokio_stream::wrappers::interval::IntervalStream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
"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
"tokio::sync::mpsc::bounded::Sender",
"tokio::time::sleep::Sleep",
]
19 changes: 19 additions & 0 deletions opentelemetry/allowed-external-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
# This is used with cargo-check-external-types to reduce the surface area of downstream crates from
# the public API. Ideally this can have a few exceptions as possible.
allowed_external_types = [
"indexmap::map::core::Entry",
"indexmap::map::iter::Drain",
"indexmap::map::iter::IterMut",
"indexmap::map::iter::Iter",
"indexmap::map::iter::IntoIter",
"indexmap::map::iter::IntoKeys",
"indexmap::map::iter::Keys",
"indexmap::map::iter::IntoValues",
"indexmap::map::iter::Values",
"indexmap::map::iter::ValuesMut",
"equivalent::Equivalent",
"futures_sink::Sink", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
"futures_core::stream::Stream", # TODO: This is a pre-1.0 crate, we can't easily stabilize with this in the public API
]

0 comments on commit 28d8cf9

Please sign in to comment.