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

[chore]: Add Profiles Marshaler to otlptext #11161

Merged
merged 22 commits into from
Oct 4, 2024

Conversation

julianocosta89
Copy link
Member

Description

This is the initial work towards #11155.
This PR adds profiles marshalers to otlptext, which will be used in the debugexporter later on.

To continue the work on the debugexporter I'd wait on the PR #11131, as it adds some shared components.

Testing

Added TestProfilesText, testing the following scenarios:

  • empty_profiles
  • two_profiles

@julianocosta89 julianocosta89 requested review from a team and evan-bradley September 12, 2024 18:58
@songy23 songy23 requested a review from mx-psi September 12, 2024 19:05
@songy23 songy23 added this to the Profiling support milestone Sep 12, 2024
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 97.36842% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.58%. Comparing base (080b765) to head (3393f24).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
exporter/internal/otlptext/databuffer.go 96.19% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11161      +/-   ##
==========================================
+ Coverage   91.54%   91.58%   +0.04%     
==========================================
  Files         428      429       +1     
  Lines       20233    20385     +152     
==========================================
+ Hits        18522    18670     +148     
- Misses       1337     1339       +2     
- Partials      374      376       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@julianocosta89 julianocosta89 requested a review from a team as a code owner September 19, 2024 08:11
pdata/testdata/profile.go Outdated Show resolved Hide resolved
@julianocosta89
Copy link
Member Author

I'm looking for some guidance here.
This test is flaky: https://github.com/open-telemetry/opentelemetry-collector/actions/runs/10957119763/job/30424592592

This is because sometimes we get the returned value as:

-> value: Map({"intValue":"42"})
-> key: Str(answer)

and sometimes like this:

-> key: Str(answer)
-> value: Map({"intValue":"42"})

Any suggestions?

@dmathieu
Copy link
Member

Your failing issue is because maps are not ordered in Go. So when the attribute table is being built with FromRaw, the generated slice doesn't guarantee order.

We could possibly ensure order by sorting the keys before injecting in FromRaw. But I'm not sure that's relevant. Maybe figuring out a way to not rely on order of the output would be better?

@julianocosta89
Copy link
Member Author

Your failing issue is because maps are not ordered in Go. So when the attribute table is being built with FromRaw, the generated slice doesn't guarantee order.

We could possibly ensure order by sorting the keys before injecting in FromRaw. But I'm not sure that's relevant. Maybe figuring out a way to not rely on order of the output would be better?

The problem is that the test is a simple comparison created_prof == two_profiles.out.

I've simplified the test to validate the AttributeTable with just one element to avoid the flakiness.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Since we don't give any guarantees regarding the debug exporter output, I don't think we need to get it perfect, and this looks good enough to me. Merging!

@mx-psi mx-psi merged commit 13951af into open-telemetry:main Oct 4, 2024
49 checks passed
@julianocosta89 julianocosta89 deleted the profiles-marshaler branch October 4, 2024 20:44
jackgopack4 pushed a commit to jackgopack4/opentelemetry-collector that referenced this pull request Oct 8, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This is the initial work towards open-telemetry#11155.
This PR adds profiles marshalers to `otlptext`, which will be used in
the `debugexporter` later on.

To continue the work on the `debugexporter` I'd wait on the PR open-telemetry#11131,
as it adds some shared components.

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added `TestProfilesText`, testing the following scenarios: 
- `empty_profiles`
- `two_profiles`
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.

4 participants