Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 2.77 KB

CONTRIBUTING.md

File metadata and controls

87 lines (60 loc) · 2.77 KB

Contributing

Welcome to OpenTelemetry Android repository!

Before you start - see OpenTelemetry general contributor guide requirements and recommendations.

Make sure to review the projects license and sign the CNCF CLA. A signed CLA will be enforced by an automatic check once you submit a PR, but you can also sign it after opening your PR.

Requirements

Java 17 or higher is required to build the projects in this repository. The built artifacts can be used with Android API Level 21 and higher. API levels 21 to 25 require desugaring of the core library.

Building opentelemetry-android

  1. Clone the repository
git clone https://github.com/open-telemetry/opentelemetry-android.git
cd opentelemetry-android
  1. To build the android artifact, run the gradle wrapper with assemble:
./gradlew assemble

The output artifacts will be in instrumentation/build/outputs/.

  1. To run the tests and code checks:
./gradlew check

Code Conventions

We use spotless to enforce a consistent code style throughout the project. This includes reformatting (linting) of both source code and markdown.

Before submitting a PR, you should ensure that your code is linted. We use the spotless gradle plugin to make this easy. You should run it like this:

./gradlew spotlessApply

Tests

Framework

By default we use JUnit 5, with some exceptions:

For both, Android and Robolectric tests, we use JUnit 4 as they currently don't support JUnit 5.

Instrumentation tests

For instrumentations that require bytecode weaving we create a test application with Android tests as those are the only kind of tests that support library bytecode weaving. Ideally we should be able to validate bytecode weaving only by creating tests using Robolectric, but that's not supported for now (for more info on the matter take a look at this google issue about it).

The test application module should be placed in the same directory as the instrumentation agent and library modules and should be named testing, as shown below:

instrumentation/
├─ my-instrumentation/
│  ├─ agent/
│  ├─ library/
│  ├─ testing/

You can take a look at how it's done for the OkHttp instrumentation here for reference.