Skip to content

RUM-4134 Remove moshi dependency from trace module#2003

Merged
mariusc83 merged 1 commit into
feature/otel-supportfrom
mconstantin/rum-4134/remove-moshi-dependency-from-trace-module
Apr 23, 2024
Merged

RUM-4134 Remove moshi dependency from trace module#2003
mariusc83 merged 1 commit into
feature/otel-supportfrom
mconstantin/rum-4134/remove-moshi-dependency-from-trace-module

Conversation

@mariusc83

Copy link
Copy Markdown
Member

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@mariusc83 mariusc83 self-assigned this Apr 19, 2024
@mariusc83
mariusc83 force-pushed the mconstantin/rum-4134/remove-moshi-dependency-from-trace-module branch from ad803f7 to 26af20a Compare April 19, 2024 15:19
@mariusc83
mariusc83 marked this pull request as ready for review April 19, 2024 15:26
@mariusc83
mariusc83 requested review from a team as code owners April 19, 2024 15:26
@mariusc83
mariusc83 force-pushed the mconstantin/rum-4134/remove-moshi-dependency-from-trace-module branch from 26af20a to 76d7653 Compare April 19, 2024 15:34
@codecov-commenter

codecov-commenter commented Apr 19, 2024

Copy link
Copy Markdown

Codecov Report

Merging #2003 (478ba84) into feature/otel-support (9a7e978) will increase coverage by 0.71%.
The diff coverage is 78.08%.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           feature/otel-support    #2003      +/-   ##
========================================================
+ Coverage                 63.17%   63.88%   +0.71%     
========================================================
  Files                       754      752       -2     
  Lines                     28504    28368     -136     
  Branches                   4679     4680       +1     
========================================================
+ Hits                      18006    18121     +115     
+ Misses                     9300     9043     -257     
- Partials                   1198     1204       +6     
Files Coverage Δ
...c/main/java/com/datadog/trace/core/CoreTracer.java 64.46% <ø> (-0.07%) ⬇️
...ain/java/com/datadog/trace/core/util/MapUtils.java 83.33% <83.33%> (ø)
...a/com/datadog/trace/core/util/JsonObjectUtils.java 87.50% <87.50%> (ø)
...adog/trace/common/sampling/TraceSamplingRules.java 89.89% <89.77%> (+71.55%) ⬆️
...tadog/trace/common/sampling/SpanSamplingRules.java 90.35% <90.35%> (+78.45%) ⬆️
...c/main/java/com/datadog/trace/core/DDSpanLink.java 5.56% <5.56%> (+1.11%) ⬆️

... and 35 files with indirect coverage changes

0xnm
0xnm previously approved these changes Apr 22, 2024

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice job!

log.error("Skipping invalid Span Sampling Rule: {} - {}", rule, error);
public static SpanSamplingRules deserializeFile(String jsonFile) {
SpanSamplingRules result = EMPTY;
try (com.google.gson.stream.JsonReader reader = new JsonReader(new FileReader(jsonFile))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it is already in the import

Suggested change
try (com.google.gson.stream.JsonReader reader = new JsonReader(new FileReader(jsonFile))) {
try (JsonReader reader = new JsonReader(new FileReader(jsonFile))) {

Comment on lines +15 to +17
lateinit var tempDir: File
override fun deserializeRules(jsonRules: String): SpanSamplingRules {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
lateinit var tempDir: File
override fun deserializeRules(jsonRules: String): SpanSamplingRules {
lateinit var tempDir: File
override fun deserializeRules(jsonRules: String): SpanSamplingRules {

Comment on lines +102 to +111
"""[
{"service": "usersvc", "name": "healthcheck", "sample_rate": $rate}
]"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems like formatting is a bit broken for raw strings in this file

Comment on lines +115 to +125
val rules = TraceSamplingRules.deserialize(
"""[
{"service": "usersvc", "name": "healthcheck", "sample_rate": 0.5},
{"service": "usersvc", "name": "healthcheck", "sample_rate": 200}
]"""
)
assertThat(rules.rules).hasSize(1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
val rules = TraceSamplingRules.deserialize(
"""[
{"service": "usersvc", "name": "healthcheck", "sample_rate": 0.5},
{"service": "usersvc", "name": "healthcheck", "sample_rate": 200}
]"""
)
assertThat(rules.rules).hasSize(1)
// When
val rules = TraceSamplingRules.deserialize(
"""[
{"service": "usersvc", "name": "healthcheck", "sample_rate": 0.5},
{"service": "usersvc", "name": "healthcheck", "sample_rate": 200}
]"""
)
// Then
assertThat(rules.rules).hasSize(1)

jonathanmos
jonathanmos previously approved these changes Apr 22, 2024
@@ -0,0 +1,163 @@
package com.datadog.trace.common.sampling

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: missing copyright

@@ -0,0 +1,123 @@
package com.datadog.trace.common.sampling

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: missing copyright

@mariusc83
mariusc83 dismissed stale reviews from jonathanmos and 0xnm via 478ba84 April 23, 2024 07:24
@mariusc83
mariusc83 force-pushed the mconstantin/rum-4134/remove-moshi-dependency-from-trace-module branch from 76d7653 to 478ba84 Compare April 23, 2024 07:24
@mariusc83
mariusc83 merged commit 4397e6d into feature/otel-support Apr 23, 2024
@mariusc83
mariusc83 deleted the mconstantin/rum-4134/remove-moshi-dependency-from-trace-module branch April 23, 2024 08:21
@xgouchet xgouchet added this to the 2.11.x milestone Jul 31, 2024
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.

5 participants