Skip to content

Commit

Permalink
Add External Type Checking (open-telemetry#1603)
Browse files Browse the repository at this point in the history
The purpose of this is to ensure we understand the API surface area. Anything exposed by a crate like a type can affect the possible compatibility. This means that if we bump an external type it could cause breaking changes. This tracks them to limit this possibility.

Affected Crates:

opentelemetry-otlp
opentelemetry-zipkin
  • Loading branch information
hdost authored Mar 8, 2024
1 parent 4aa4827 commit bcf1205
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
external-types:
strategy:
matrix:
example: [opentelemetry, opentelemetry-sdk]
example: [opentelemetry, opentelemetry-sdk, opentelemetry-otlp, opentelemetry-zipkin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
22 changes: 22 additions & 0 deletions opentelemetry-otlp/allowed-external-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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::*",
"opentelemetry_http::*",
"opentelemetry_sdk::*",
# http is a pre 1.0 crate
"http::uri::InvalidUri",
"http::header::name::InvalidHeaderName",
"http::header::value::InvalidHeaderValue",
# prost is a pre 1.0 crate
"prost::error::EncodeError",
# tonic is a pre 1.0 crate
"tonic::status::Code",
"tonic::status::Status",
"tonic::metadata::map::MetadataMap",
"tonic::transport::channel::Channel",
"tonic::transport::error::Error",
"tonic::service::interceptor::Interceptor",
]
12 changes: 12 additions & 0 deletions opentelemetry-zipkin/allowed-external-types.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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::*",
"opentelemetry_http::*",
"opentelemetry_sdk::*",
# http is a pre 1.0 crate
"http::error::Error",
"http::uri::InvalidUri",
]

0 comments on commit bcf1205

Please sign in to comment.