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

Simplify Bundling of UI assets #5917

Merged
merged 19 commits into from
Sep 2, 2024

Conversation

mahadzaryab1
Copy link
Contributor

@mahadzaryab1 mahadzaryab1 commented Sep 1, 2024

Which problem is this PR solving?

Description of the changes

  • Created one file assets.go that holds both the placeholder and actual assets.
  • Added a helper GetStaticFiles to get the assets based on whether the actual filesystem has an index.html.gz. If it does, we return the assets. Otherwise, we return the placeholder index.html file.

How was this change tested?

Added unit tests and performed the following manual tests

Test 1

Makefile Target

.PHONY: run-all-in-one
run-all-in-one:
	go run ./cmd/all-in-one --log-level debug

Clearing out the actual directory and ran make run-all-in-one. Going to http://localhost:16686/ renders the placeholder HTML page.

Test 2

Makefile Target

.PHONY: run-all-in-one
run-all-in-one: build-ui
	go run ./cmd/all-in-one --log-level debug

Ran make run-all-in-one. Going to http://localhost:16686/ renders the Jaeger UI.

Checklist

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.81%. Comparing base (5bd6980) to head (2b62656).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5917   +/-   ##
=======================================
  Coverage   96.81%   96.81%           
=======================================
  Files         342      343    +1     
  Lines       16525    16528    +3     
=======================================
+ Hits        15998    16001    +3     
  Misses        340      340           
  Partials      187      187           
Flag Coverage Δ
badger_v1 8.05% <ø> (ø)
badger_v2 1.82% <ø> (ø)
cassandra-3.x-v1 16.62% <ø> (ø)
cassandra-3.x-v2 1.75% <ø> (ø)
cassandra-4.x-v1 16.62% <ø> (ø)
cassandra-4.x-v2 1.75% <ø> (ø)
elasticsearch-6.x-v1 18.78% <ø> (ø)
elasticsearch-7.x-v1 18.85% <ø> (ø)
elasticsearch-8.x-v1 19.03% <ø> (ø)
elasticsearch-8.x-v2 1.82% <ø> (ø)
grpc_v1 9.49% <ø> (ø)
grpc_v2 7.16% <ø> (ø)
kafka-v1 9.74% <ø> (ø)
kafka-v2 1.82% <ø> (ø)
memory_v2 1.82% <ø> (+0.01%) ⬆️
opensearch-1.x-v1 18.89% <ø> (-0.02%) ⬇️
opensearch-2.x-v1 18.90% <ø> (ø)
opensearch-2.x-v2 1.82% <ø> (+0.01%) ⬆️
tailsampling-processor 0.46% <ø> (ø)
unittests 95.29% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mahadzaryab1 mahadzaryab1 changed the title [WIP] Simplify bundling of UI assets Simplify Bundling of UI assets Sep 1, 2024
@mahadzaryab1 mahadzaryab1 marked this pull request as ready for review September 1, 2024 19:37
@mahadzaryab1 mahadzaryab1 requested a review from a team as a code owner September 1, 2024 19:37
@dosubot dosubot bot added the ui label Sep 1, 2024
cmd/query/app/ui/assets.go Show resolved Hide resolved
cmd/query/app/ui/assets.go Outdated Show resolved Hide resolved
cmd/query/app/ui/doc.go Outdated Show resolved Hide resolved
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
cmd/query/app/static_handler.go Outdated Show resolved Hide resolved
cmd/query/app/ui/assets.go Outdated Show resolved Hide resolved
cmd/query/app/ui/assets_test.go Outdated Show resolved Hide resolved
cmd/query/app/ui/assets_test.go Outdated Show resolved Hide resolved
mahadzaryab1 and others added 2 commits September 1, 2024 20:47
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@mahadzaryab1
Copy link
Contributor Author

mahadzaryab1 commented Sep 2, 2024

@yurishkuro anything we can do about the failing codecoverage step?

@yurishkuro
Copy link
Member

yurishkuro commented Sep 2, 2024

you could have another test where you swap actualFS for a test fixture, e.g.

ui/testdata/
  actual/
    index.html.gz -- dummy file
  mock.go // embed fake actual here

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@mahadzaryab1
Copy link
Contributor Author

you could have another test where you swap actualFS for a test fixture, e.g.

ui/testdata/
  actual/
    index.html.gz -- dummy file
  mock.go // embed fake actual here

thanks for the suggestion! I added a second test in.

Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@yurishkuro yurishkuro merged commit 7df6975 into jaegertracing:main Sep 2, 2024
48 checks passed
@yurishkuro
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify bundling of UI assets
2 participants