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.
This commit is contained in:
Harold Dost 2023-10-23 23:27:06 +02:00 committed by GitHub
parent aa586cbf7e
commit 28d8cf9b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 0 deletions

View File

@ -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:

View File

@ -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",
]

View File

@ -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
]