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

Support uploading traces in OpenTelemetry format (OTLP JSON) #2145

Merged
merged 9 commits into from
Mar 4, 2024

Conversation

NavinShrinivas
Copy link
Contributor

@NavinShrinivas NavinShrinivas commented Jan 31, 2024

Which problem is this PR solving?

Description of the changes

  • Adds a redux middleware to make API calls to convert OTLP traces to jaeger traces when uploaded

How was this change tested?

  • Unit test have been written, but apart form that OTLP traces were fed into the frontend (when compiled using all-in-one) to get correct behabiour

Checklist

Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.59%. Comparing base (aba6c2c) to head (1e33ca7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2145   +/-   ##
=======================================
  Coverage   96.59%   96.59%           
=======================================
  Files         254      254           
  Lines        7629     7639   +10     
  Branches     1988     1990    +2     
=======================================
+ Hits         7369     7379   +10     
  Misses        260      260           

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

@NavinShrinivas
Copy link
Contributor Author

Hey, are you waiting for commits to meet the test requirement? I'd like to more this pr forward with necessary changes

@yurishkuro
Copy link
Member

please make sure the CI is green.

@yurishkuro yurishkuro added the changelog:new-feature Change that should be called out as new feature in CHANGELOG label Feb 5, 2024
@yurishkuro yurishkuro changed the title Add middleware to accept OTLP traces when uploaded Support uploading traces in OpenTelemetry format (OTLP JSON) Feb 5, 2024
@yurishkuro yurishkuro marked this pull request as ready for review February 11, 2024 21:05
@yurishkuro yurishkuro requested a review from a team as a code owner February 11, 2024 21:05
@yurishkuro yurishkuro requested review from joe-elliott and removed request for a team February 11, 2024 21:05
yurishkuro
yurishkuro previously approved these changes Feb 11, 2024
@yurishkuro
Copy link
Member

I found one issue. When I try to upload OTLP-formatted file, I am getting an exception in the UI code:
image
in this function

function loadJsonDone(state, { payload }) {
  const processed = payload.data.map(transformTraceData);

The payload here is still OTLP-formatted, so it has no .data and .map throws. I don't fully understand how these "actions" work, but is it perhaps possible to ensure that your new transformer action is called before the execution reaches into loadJsonDone?

@yurishkuro
Copy link
Member

And on a related question - is it possible to ensure that we have a unit test that catches this?

Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
@@ -70,7 +70,7 @@ export const loadJsonTracesMiddleware = store => next => action => {
} else {
return next(action);
}
return next(action); // Consistent returns
return undefined;
Copy link
Member

Choose a reason for hiding this comment

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

why is this the right behavior?

Copy link
Member

Choose a reason for hiding this comment

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

I assume calling the next action is a pattern that needs to be maintained, it looks like a dangerous shortcut when you change it just to work around another problem. The right fix is to control the order of these middlewares, so that OTLP translator is invoked before the rest of the handlers.

yurishkuro added a commit to jaegertracing/jaeger that referenced this pull request Feb 14, 2024
…5155)

## Which problem is this PR solving?
* Solves #4949 
* In combination with
jaegertracing/jaeger-ui#2145

## Description of the changes
- Incorporates changes from previous draft PR review 
- Adds middleware in frontend as well

## How was this change tested?
- Unit tests and supplying valid and invalid OTLP traces using insomnia
to test the API

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Signed-off-by: Navin Shrinivas <karupal2002@gmail.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

I tried a few other ways, but there's a complication with JaegerAPI returning a future while all other code paths are synchronous. Will merge as is.

@yurishkuro yurishkuro merged commit d8bf9b9 into jaegertracing:main Mar 4, 2024
8 checks passed
@yurishkuro
Copy link
Member

thanks!

@NavinShrinivas
Copy link
Contributor Author

NavinShrinivas commented Mar 4, 2024

thanks!

It was fun working on this issues. Learnt a lot :) , any other issue that i can work on that are beginner friendly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:new-feature Change that should be called out as new feature in CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants