-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: move compose instrumentation to a separate compose package #24
base: main
Are you sure you want to change the base?
Conversation
f8ab6cb
to
cdeca26
Compare
@@ -172,7 +172,7 @@ class MainActivity : ComponentActivity() { | |||
``` | |||
|
|||
#### Usage | |||
Wrap your SwiftUI views with `HoneycombInstrumentedComposable(name: String)`, like so: | |||
Wrap your Composables with `HoneycombInstrumentedComposable(name: String)`, like so: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
cdeca26
to
6c93a35
Compare
6c93a35
to
20299be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on my experiences with the OpenTelemetry SDK, I'd strongly prefer if we have all our libraries use the same version number. Since there will be dependencies between our libraries, whenever customers want to upgrade one of them, they'll have to upgrade all of them, and that turns into a guessing game of what version works with which version. It's a whole lot easier if they can just change the one "honeycomb" version in their libs.versions.toml
and get all the right auto-instrumentation versions.
I also think it would be really nice if we can have a release process where we just change the version number in one place, which I assume shouldn't be too hard with gradle. Is this how our Java SDK does it? |
fb3b22a
to
ccca974
Compare
aec1da5
to
42b0fb3
Compare
42b0fb3
to
679f32f
Compare
var expectedVersion = System.getenv("CIRCLE_TAG") | ||
expectedVersion = expectedVersion?.slice(1 until expectedVersion.length) ?: "0.0.0-DEVELOPMENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and the similar block in HoneycombOptionsUnitTest
below, feels clumsy, but without it, our unit tests would fail only when we do releases (since the app now gets the version number from the CI_TAG variable directly).
Other suggestions/implementations welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this particular test is to test that the options are set correctly, and the other one is to test that the resource attributes are set correctly. They aren't tests of our build system.
So, I think both here and there, we should just use BuildConfig.HONEYCOMB_DISTRO_VERSION
as the expected value.
If we want a test or verification of our build process setting up the BuildConfig
environment variable correctly, I think we should do that elsewhere, explicitly. But I'm not sure if that's necessary at this point. I don't even know what the failure mode would be... that a released SDK doesn't return the version number it was released as? That seems pretty difficult to verify, and would probably need to be a post-build step or something.
- Push the tag upstream (this will kick off the release pipeline in CI) e.g. `git push origin v1.2.3` | ||
- Copy change log entry for newest version into draft GitHub release created as part of CI publish steps. | ||
- Make sure to "generate release notes" in github for full changelog notes and any new contributors | ||
- Publish the github draft release and this will kick off publishing to GitHub and the NPM registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the NPM registry
other oops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not even sure if we need this part about publishing a GitHub release? Is that something we want? It just takes the tag to push to maven.
@@ -1,11 +1,16 @@ | |||
# Releasing | |||
|
|||
- `Add steps to prepare release` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on #25, the only "prepare release" steps were to go through the codebase and manually update the version number.
However, now that we're taking it from the git tag directly, we don't need this at all, and can just skip straight to updating the Changelog + pushing a new tag.
## Which problem is this PR solving? While working on #24, I noticed Android Studio had updated the compiler config in the `.idea` directory to drop down to java compiler 17 (instead of 21). Similarly, I started seeing warnings like ``` > Task :core:compileDebugJavaWithJavac Java compiler version 21 has deprecated support for compiling with source/target version 8. Try one of the following options: 1. [Recommended] Use Java toolchain with a lower language version 2. Set a higher source/target version 3. Use a lower version of the JDK running the build (if you're not using Java toolchain) For more details on how to configure these settings, see https://developer.android.com/build/jdks. To suppress this warning, set android.javaCompile.suppressSourceTargetDeprecationWarning=true in gradle.properties. warning: [options] source value 8 is obsolete and will be removed in a future release warning: [options] target value 8 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. 3 warnings ``` ([job link](https://app.circleci.com/pipelines/github/honeycombio/honeycomb-opentelemetry-android/314/workflows/4554f6fc-9054-484f-b9be-9b4d550befdf/jobs/887)) The documentation for the CircleCI Android orb implies that Java 17 is the default but clearly it's actually using Java 21. ## Short description of the changes This PR updates our CircleCI config to explicitly use 17, and commits the updated Android Studio config to keep local dev environments in line. ## How to verify that this has the expected result [The same job](https://app.circleci.com/pipelines/github/honeycombio/honeycomb-opentelemetry-android/320/workflows/5a1065e9-47d1-4e2f-941e-ac546bec7238/jobs/901) no longer spits out the `Java compiler version 21` warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good. The only thing I really think should be changed are those tests you asked about.
@@ -153,7 +153,7 @@ These events may have the following attributes. | |||
Initialize the `Honeycomb` sdk, and then wrap your entire app in a `CompositionLocalProvider` that provides `LocalOpenTelemetryRum`, as so: | |||
|
|||
```kotlin | |||
import io.honeycomb.opentelemetry.android.LocalOpenTelemetryRum | |||
import io.honeycomb.opentelemetry.android.compose.LocalOpenTelemetryRum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should update the README to tell them they need to add a dependency on the new library?
var expectedVersion = System.getenv("CIRCLE_TAG") | ||
expectedVersion = expectedVersion?.slice(1 until expectedVersion.length) ?: "0.0.0-DEVELOPMENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this particular test is to test that the options are set correctly, and the other one is to test that the resource attributes are set correctly. They aren't tests of our build system.
So, I think both here and there, we should just use BuildConfig.HONEYCOMB_DISTRO_VERSION
as the expected value.
If we want a test or verification of our build process setting up the BuildConfig
environment variable correctly, I think we should do that elsewhere, explicitly. But I'm not sure if that's necessary at this point. I don't even know what the failure mode would be... that a released SDK doesn't return the version number it was released as? That seems pretty difficult to verify, and would probably need to be a post-build step or something.
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean... I dunno... I can see some value leaving a placeholder unit test here, because that's a lot less annoying than adding one later, but this is pretty irrelevant. I'm not sure what to do about it, though.
- Update `CHANGELOG.md` with the changes since the last release. | ||
- One quick way to do this is to run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sold on this, and I would suggest we not put this part in there right now. I think it works a lot better to add human-readable things to the CHANGELOG as we make commits, and then just change vNext to the real version number when doing a release.
I'm happy to discuss it, and I might be wrong and this way is better, but I'd rather just leave that discussion for later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see, make changes to CHANGELOG on in each PR, and then just update the heading when we're doing a release. That works for me. I swiped this section from our RELEASING.md in the web distro but I like your pitch better.
- Push the tag upstream (this will kick off the release pipeline in CI) e.g. `git push origin v1.2.3` | ||
- Copy change log entry for newest version into draft GitHub release created as part of CI publish steps. | ||
- Make sure to "generate release notes" in github for full changelog notes and any new contributors | ||
- Publish the github draft release and this will kick off publishing to GitHub and the NPM registry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not even sure if we need this part about publishing a GitHub release? Is that something we want? It just takes the tag to push to maven.
Which problem is this PR solving?
Move Compose instrumentation from #20 into a separate package.
Short description of the changes
io.honeycomb.opentelemetry.android.compose
and movedHoneycombInstrumentedComposable
andLocalOpenTelemetryRum
to that package.LocalOpenTelemetryRum
in the main package but thecompose
package needs to read it and I wasn't sure how we felt about making thecompose
package depend on the main package.Right now both packages can have different version numbers, but the build will fail if either package's version number already exists on Maven Central. This feels usable to me but a little gross/suboptimal? It means that a minor or patch change in one package will require a new artifact for the other package, even if there are no changes.I updated our release process to take the version number from the git tag directly. This means that both packages will use the same version number. Based on PR comments, it sounds like we actually want this!How to verify that this has the expected result
I pushed a
v0.0.1-experimental2
tag pointed at the last commit on this branch to test the deployment process. The build ran successfully and pushes both artifacts to maven central. (core package | compose)I further pushed a
v0.0.1-experimental3
tag. Results:build: https://app.circleci.com/pipelines/github/honeycombio/honeycomb-opentelemetry-android/310/workflows/eecdecfa-d848-40f0-a67c-96072b5ee616
core package: https://central.sonatype.com/artifact/io.honeycomb.android/honeycomb-opentelemetry-android/0.0.1-experimental3
compose package: https://central.sonatype.com/artifact/io.honeycomb.android/honeycomb-opentelemetry-android-compose