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

Make ArchiveTrace button auto-configurable #1944

Merged
merged 3 commits into from
Nov 11, 2023

Conversation

thecoons
Copy link
Contributor

@thecoons thecoons commented Nov 5, 2023

The button to archive a trace is now configured based on the state of
the QueryService in addition to the UI configuration.

All corresponding tests have been updated.


Signed-off-by: Barthelemy Antonin antobarth@gmail.com

@thecoons thecoons requested a review from a team as a code owner November 5, 2023 14:23
@thecoons thecoons requested review from jkowall and removed request for a team November 5, 2023 14:23
@thecoons thecoons marked this pull request as draft November 5, 2023 14:23
@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 8d947e7 to 501157e Compare November 5, 2023 14:36
Copy link

codecov bot commented Nov 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
...kages/jaeger-ui/src/components/TracePage/index.tsx 99.43% <100.00%> (+<0.01%) ⬆️
...ackages/jaeger-ui/src/constants/default-config.tsx 75.00% <ø> (ø)
packages/jaeger-ui/src/utils/config/get-config.tsx 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!

@yurishkuro yurishkuro added the changelog:new-feature Change that should be called out as new feature in CHANGELOG label Nov 5, 2023
yurishkuro added a commit to jaegertracing/jaeger that referenced this pull request Nov 7, 2023
## Which problem is this PR solving?
- backend part of #4874

## Description of the changes
The button to archive a trace is now configured based on the state of
the QueryService in addition to the UI configuration. It is now
possible to request features from the QueryService to inject them
into the UI.

Related UI change jaegertracing/jaeger-ui#1944

## How was this change tested?
All corresponding tests have been updated.

## 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

---------

Signed-off-by: Antonin Barthelemy <antobarth@gmail.com>

---------

Signed-off-by: Barthelemy Antonin <antobarth@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
@thecoons thecoons force-pushed the make_archivetrace_auto_config branch 2 times, most recently from 14cb59b to 7f269a6 Compare November 9, 2023 13:12
@thecoons
Copy link
Contributor Author

thecoons commented Nov 9, 2023

When I use the command make run-all-in-one, the queryservice is configured with an in-memory storage, yet when retrieving the capabilities, it shows archiveStorage as false. Does this storage indeed have a non-null reader/writer?

Screenshot from 2023-11-09 14-14-57

@yurishkuro
Copy link
Member

yurishkuro commented Nov 9, 2023

I see the issue. This commit yurishkuro/jaeger@9f0e622 modifies the placeholder for the UI to look similar to the index.html in this UI PR. With that change if you run go run ./cmd/all-in-one you should get a placeholder HTML page but with variables substituted accordingly. However, this is the substitution that actually happens:

<title>Test Page</title>
  | <!--
  | This comment emulates the corresponding content in jaeger-ui/packages/jaeger-ui/index.html
  | which contains placeholders that are replaced on load by the query service in order to customize
  | the UI configuration.
  |  
  | // JAEGER_CONFIG_JS
  |  
  | JAEGER_CONFIG = DEFAULT_CONFIG;
  |  
  | JAEGER_COMPATIBILITIES = DEFAULT_COMPATIBILITIES;
  |  
  | JAEGER_VERSION = {"gitCommit":"","gitVersion":"","buildDate":""};
  | -->

Note that verison was replaced, but capabilities were not. It's because your regex pattern in the Go code is using different names than in the UI index.html

Suggestion:

  • apply the change from the above commit to Go code Make UI placeholder more descriptive jaeger#4937
  • change the unit test to use the placeholder html instead of cmd/query/app/fixture/index.html so that we can ensure that we're using the same strings
  • up to you if you want to keep the vars as JAEGER_COMPATIBILITIES or JAEGER_STORAGE_COMPATIBILITIES (I prefer the latter), but they must be consistent between the backend and the UI.
    • It would be nice if we could actually guarantee somehow that the strings are always the same, but I don't have a suggestion how to achieve that robustly. At minimum we need to ensure that the strings are identical between ui/index.html and cmd/query/app/ui/placeholder/index.html (and remove cmd/query/app/fixture/index.html altogether)

@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 7f269a6 to 184438f Compare November 10, 2023 11:36
@thecoons thecoons marked this pull request as ready for review November 10, 2023 11:38
@thecoons
Copy link
Contributor Author

It would be nice if we could actually guarantee somehow that the strings are always the same, but I don't have a suggestion how to achieve that robustly.

I think the best approach would be to separate the query service from the UI and have them communicate through an API. Currently, I don't see a way to ensure consistency between the backend and the UI without creating a house of cards.

@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 184438f to 75e41d3 Compare November 10, 2023 12:05
@thecoons
Copy link
Contributor Author

thecoons commented Nov 10, 2023

I trapped myself with the variable naming....
I made the changes and the feature is functional. The pull request is open.

change the unit test to use the placeholder html instead of cmd/query/app/fixture/index.html so that we can ensure that we're using the same strings

I will open a pull request for this change.

@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 75e41d3 to a93c014 Compare November 10, 2023 14:13
@thecoons thecoons force-pushed the make_archivetrace_auto_config branch 3 times, most recently from 056a576 to 2bef1d9 Compare November 11, 2023 19:06
Comment on lines 61 to 62
let capabilities;
let getJaegerStorageCapabilities;
Copy link
Member

Choose a reason for hiding this comment

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

why do these need to be made global within the tests instead of being local vars inside beforeEach function? Only embedded is used in some tests.

Copy link
Contributor Author

@thecoons thecoons Nov 11, 2023

Choose a reason for hiding this comment

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

Alternatively, we should use capabilities in all the expected fields because when I read the tests, it is technically possible for it to be overridden by a field in embedded.

ex: 'gives precedence to non-objects in embedded'

@thecoons
Copy link
Contributor Author

I have implemented the suggestions you had made.
Please don't hesitate to point out anything that seems to need further work.

@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 2bef1d9 to a924197 Compare November 11, 2023 19:28
@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from a924197 to 86c8cb3 Compare November 11, 2023 19:31
- Resolves #4874

The button to archive a trace is now configured based on the state of
the QueryService in addition to the UI configuration.

All corresponding tests have been updated.

- [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

---------

Signed-off-by: Barthelemy Antonin <antobarth@gmail.com>
@thecoons thecoons force-pushed the make_archivetrace_auto_config branch from 86c8cb3 to 676c671 Compare November 11, 2023 19:36
yurishkuro
yurishkuro previously approved these changes Nov 11, 2023
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.

thanks!

@yurishkuro yurishkuro enabled auto-merge (squash) November 11, 2023 23:12
Signed-off-by: Yuri Shkuro <github@ysh.us>
yurishkuro
yurishkuro previously approved these changes Nov 11, 2023
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro merged commit 8a88b39 into jaegertracing:main Nov 11, 2023
10 checks passed
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.

[Feature] Make ArchiveTrace button in the UI auto-configurable
2 participants