Skip to content
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

Add otel log data source for internal errors #886

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

fractalwrench
Copy link
Contributor

Goal

Implements our internal telemetry using OTel logs. This is not hooked up to data capture yet - that will be done in a separate PR.

Testing

Added unit tests.

@fractalwrench fractalwrench requested a review from a team as a code owner May 24, 2024 12:53
@fractalwrench fractalwrench force-pushed the initial-otel-internal-errors branch from 33313c5 to d4e6744 Compare May 24, 2024 15:18
Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.86%. Comparing base (2dbfee7) to head (6ee1288).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #886      +/-   ##
==========================================
- Coverage   81.00%   80.86%   -0.15%     
==========================================
  Files         440      441       +1     
  Lines       11745    11752       +7     
  Branches     1795     1794       -1     
==========================================
- Hits         9514     9503      -11     
- Misses       1440     1456      +16     
- Partials      791      793       +2     
Files Coverage Δ
.../java/io/embrace/android/embracesdk/EmbraceImpl.kt 80.00% <100.00%> (-0.31%) ⬇️
.../embrace/android/embracesdk/arch/schema/EmbType.kt 88.88% <100.00%> (+0.25%) ⬆️
...brace/android/embracesdk/arch/schema/SchemaType.kt 80.80% <100.00%> (+0.70%) ⬆️
...pture/envelope/session/SessionPayloadSourceImpl.kt 100.00% <ø> (ø)
...ure/internal/errors/InternalErrorDataSourceImpl.kt 100.00% <100.00%> (ø)
...e/android/embracesdk/injection/DataSourceModule.kt 100.00% <100.00%> (ø)
...embrace/android/embracesdk/injection/InitModule.kt 100.00% <100.00%> (ø)
...oid/embracesdk/injection/ModuleInitBootstrapper.kt 92.64% <100.00%> (ø)
...race/android/embracesdk/injection/PayloadModule.kt 100.00% <ø> (ø)
...race/android/embracesdk/injection/SessionModule.kt 100.00% <ø> (ø)
... and 4 more

... and 11 files with indirect coverage changes

Base automatically changed from alter-func-sig to master May 28, 2024 09:23
@fractalwrench fractalwrench force-pushed the initial-otel-internal-errors branch from d4e6744 to 5f5f8e8 Compare May 28, 2024 10:17
@@ -57,6 +57,8 @@ internal sealed class EmbType(type: String, subtype: String?) : TelemetryType {

internal object Exception : System("exception")

internal object InternalError : System("internal")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a name that indicates that it's some sort of error or warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what was suggested with Pablo/Austin

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess these don't have to something bad. But there's a pedanticness rising in me that says this should be a noun.........

I'll suck it up lol

Copy link
Collaborator

@bidetofevil bidetofevil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Question about why it's only called sys.internal and doesn't indicate that there's some sort of unexpected error, but that's not blocking

alterSessionSpan(NoInputValidation) {
this.addLog(throwable, true) {
val schemaType = SchemaType.InternalError(throwable)
LogEventData(schemaType, Severity.ERROR, "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be make these logs private so they are not exported to the generic exporter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that supplying true to addLog was enough to do that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sweet you're right!

@fractalwrench fractalwrench force-pushed the initial-otel-internal-errors branch 5 times, most recently from 7a32051 to 1c4518b Compare June 10, 2024 15:59
@fractalwrench fractalwrench force-pushed the initial-otel-internal-errors branch from 1c4518b to 6ee1288 Compare June 10, 2024 16:29
@fractalwrench fractalwrench merged commit 37f39f7 into master Jun 10, 2024
4 checks passed
@fractalwrench fractalwrench deleted the initial-otel-internal-errors branch June 10, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants