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

[ObsUX] [APM] Migrate APM from styled-components to @emotion #204222

Merged

Conversation

MiriamAparicio
Copy link
Contributor

@MiriamAparicio MiriamAparicio commented Dec 13, 2024

Closes #202765

Summary

While working on the visual refresh for the new EUI theme Borealis we figured that was a good time to do the recommended migration from styled-components to @emotion

What has been done

  • Migrate apm plugin from styled-components to @emotion
  • Eui Visual Refresh for Borealis new theme
  • All usage of color palette tokens and functions now pull from the theme, and correctly update to use new colors when the theme changes from Borealis to Amsterdam and vice versa
  • All references to renamed tokens have been updated to use the new token name
  • Remove usage of deprecated useEuiBackgroundColor
  • All usages of "success" colors have been updated to accentSecondary and textAccentSecondary as needed

Not this time

There are some color values on the server side, and the values are static they would not update properly as dynamic tokens do. Eui guidance right now is to keep these as they are for now (meaning to keep using the JSON tokens).

How to test

Running Kibana with the Borealis theme

In order to run Kibana with Borealis, you'll need to do the following:

  • Set the following in kibana.dev.yml: uiSettings.experimental.themeSwitcherEnabled: true
  • Run Kibana with the following environment variable set: KBN_OPTIMIZER_THEMES="borealislight,borealisdark,v8light,v8dark" yarn start
  • This will expose a toggle under Stack Management > Advanced Settings > Theme version, which you can use to toggle between Amsterdam and Borealis.

@MiriamAparicio MiriamAparicio force-pushed the 202765-apm-emotion-migration branch from 6168cfd to 145d376 Compare December 16, 2024 13:09
@MiriamAparicio MiriamAparicio added backport:skip This commit does not require backporting v9.0.0 Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team EUI Visual Refresh labels Dec 17, 2024
@MiriamAparicio MiriamAparicio marked this pull request as ready for review December 17, 2024 14:15
@MiriamAparicio MiriamAparicio requested review from a team as code owners December 17, 2024 14:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Dec 17, 2024
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@MiriamAparicio MiriamAparicio added the release_note:skip Skip the PR/issue when compiling release notes label Dec 17, 2024
Copy link

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

LGTM 👌🏻 I just have 3 suggestions

@MiriamAparicio MiriamAparicio requested a review from a team as a code owner December 17, 2024 16:14
@crespocarlos crespocarlos self-requested a review December 18, 2024 10:05
iconType="apmTrace"
title={
<h2>
{i18n.translate('xpack.apm.transactionLink.h2.fetchingTransactionLabel', {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@MiriamAparicio MiriamAparicio force-pushed the 202765-apm-emotion-migration branch from 3094308 to 9a42d79 Compare December 18, 2024 11:05
Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

code LGTM.

edit: I tested it in dark and light mode and couldn't find anything wrong. disclaimer: my eyes are not trained to find problems with the new theme

Copy link
Contributor

@iblancof iblancof left a comment

Choose a reason for hiding this comment

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

Thanks for all the small changes, it's a huge effort! 👏🏻
After reviewing the code, I left some comments.

I’m going to test locally now!
If I notice anything, I’ll leave another comment, otherwise, I won’t.

Copy link
Contributor

@miloszmarcinkowski miloszmarcinkowski left a comment

Choose a reason for hiding this comment

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

Good job! LGTM with only one suggestion 🚀

@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 18, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: ceaf0a3
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-204222-ceaf0a3b1881

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1923 1928 +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.3MB 5.7MB ⚠️ +2.3MB
infra 1.7MB 1.7MB +84.0B
total ⚠️ +2.3MB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
apm 38.7KB 38.5KB -173.0B
observabilityShared 93.9KB 93.9KB +51.0B
total -122.0B
Unknown metric groups

async chunk count

id before after diff
apm 56 60 +4

ESLint disabled line counts

id before after diff
infra 43 42 -1

Total ESLint disabled count

id before after diff
infra 52 51 -1

History

/x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
/x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
/x-pack[\/\\]plugins[\/\\](beats_management|fleet|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
/x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\](beats_management|fleet|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line has been messed up with the recent platform migration. I don't think there are observability plugins within security solutions.

Copy link
Contributor

Choose a reason for hiding this comment

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

This file has been a source of conflicts since the start of the relocation of modules.
I've just created #204785 to cleanup / simplify the file and hopefully avoid more headaches.

Copy link
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

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

LGTM

@MiriamAparicio
Copy link
Contributor Author

/oblt-deploy

Copy link
Contributor

@yngrdyn yngrdyn left a comment

Choose a reason for hiding this comment

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

Logs changes LGMT 👏🏼

@MiriamAparicio MiriamAparicio merged commit fb0cb57 into elastic:main Dec 18, 2024
8 checks passed
@MiriamAparicio MiriamAparicio deleted the 202765-apm-emotion-migration branch December 18, 2024 17:13
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Dec 19, 2024
…#204222)

Closes elastic#202765

### Summary
While working on the visual refresh for the new EUI theme Borealis we
figured that was a good time to do the recommended migration from
`styled-components` to `@emotion`

### What has been done

- Migrate apm plugin from `styled-components` to `@emotion`
- Eui Visual Refresh for Borealis new theme
- All usage of color palette tokens and functions now pull from the
theme, and correctly update to use new colors when the theme changes
from Borealis to Amsterdam and vice versa
- All references to renamed tokens have been updated to use the new
token name
- Remove usage of deprecated `useEuiBackgroundColor`
- All usages of "success" colors have been updated to `accentSecondary`
and `textAccentSecondary` as needed

### Not this time

There are some color values on the server side, and the values are
static they would not update properly as dynamic tokens do. Eui guidance
right now is to keep these as they are for now (meaning to keep using
the JSON tokens).

### How to test
#### Running Kibana with the Borealis theme
In order to run Kibana with Borealis, you'll need to do the following:

- Set the following in kibana.dev.yml:
uiSettings.experimental.themeSwitcherEnabled: true
- Run Kibana with the following environment variable set:
KBN_OPTIMIZER_THEMES="borealislight,borealisdark,v8light,v8dark" yarn
start
- This will expose a toggle under Stack Management > Advanced Settings >
Theme version, which you can use to toggle between Amsterdam and
Borealis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project EUI Visual Refresh release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ObsUX] [APM] Migrate APM from styled-components to @emotion