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

[Perfomance] Add Inline documentation for TTFMP #212393

Merged
merged 16 commits into from
Mar 4, 2025

Conversation

kpatticha
Copy link
Contributor

Summary

closes https://github.com/elastic/observability-dev/issues/4101

image

⚠️ Instrumentation

Pass the description as metadata. The prefix [TTFMP] is required.

How to test

  • Checkout the PR
  • make sure you run yarn kbn bootstrap
  • go to any page that has onPageReady function instrumented (ex services)

@kpatticha kpatticha requested review from a team as code owners February 25, 2025 15:13
@botelastic botelastic bot added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Feb 25, 2025
@elasticmachine
Copy link
Contributor

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

@yngrdyn
Copy link
Contributor

yngrdyn commented Feb 25, 2025

This is a nice addition 👏🏼
What we also do for dataset quality is to explicitly mark visually what is the component reporting TTFMP
image
but of course, this is possible because we have a dedicated dashboard, might be messy to have something like this in an overview dashboard for all obs apps

@kpatticha kpatticha added v9.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Feb 25, 2025
@kpatticha kpatticha added the backport:skip This commit does not require backporting label Feb 25, 2025
if (description?.length > MAX_DESCRIPTION_LENGTH) {
// eslint-disable-next-line no-console
console.error(
`The description for the measure: ${target} is too long. The maximum length is ${MAX_DESCRIPTION_LENGTH}. Strings longer than ${MAX_DESCRIPTION_LENGTH} will not be indexed or stored`
Copy link
Contributor

@bryce-b bryce-b Feb 25, 2025

Choose a reason for hiding this comment

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

Is there a discrepancy here when considering the added length of the prefix [TTFMP] resulting in the actual acceptable length of text entered being 248? Is that worth being denoted in the error message?

Copy link
Contributor Author

@kpatticha kpatticha Feb 26, 2025

Choose a reason for hiding this comment

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

Since the prefix is mandatory, the total allowed length remains 256 characters.

The console error will only be visible to developers, but I want to include a warning because any input exceeding 256 characters will be ignored by the indexer due to ignore_above 256 , as long keywords tend to cause issues in ES.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

console.warn probably fit better

Copy link
Member

Choose a reason for hiding this comment

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

Do we only want to warn, or do we also want to truncate the description to the max size?
Maybe in some cases, the warning is missed, and we send a very long description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The string will no be indexed above 256 but it's a good point. We could truncate and avoid sending the long text which won't be indexed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated here 1cb6e66

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM, just some open questions.

@kpatticha kpatticha enabled auto-merge (squash) February 26, 2025 11:30
@kpatticha kpatticha disabled auto-merge February 27, 2025 11:59
@kpatticha
Copy link
Contributor Author

@elastic/obs-ui-devex-team

Copy link
Contributor

@awahab07 awahab07 left a comment

Choose a reason for hiding this comment

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

LGTM!

Tested and it works as expected. Thanks for adding description in meta.

type ApmPageId = 'services' | 'traces' | 'dependencies';
type InfraPageId = 'hosts';

export type Key = `${ApmPageId}` | `${InfraPageId}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will all plugins have to define their page keys explicitly here? Is this to discourage changing prefixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the idea is also to encourage consistency, discoverability and avoid duplicate keys.

@kpatticha kpatticha enabled auto-merge (squash) February 28, 2025 15:29
Copy link
Member

@maryam-saeidi maryam-saeidi 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!

Added a comment about truncating the description if it is long.

if (description?.length > MAX_DESCRIPTION_LENGTH) {
// eslint-disable-next-line no-console
console.error(
`The description for the measure: ${target} is too long. The maximum length is ${MAX_DESCRIPTION_LENGTH}. Strings longer than ${MAX_DESCRIPTION_LENGTH} will not be indexed or stored`
Copy link
Member

Choose a reason for hiding this comment

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

Do we only want to warn, or do we also want to truncate the description to the max size?
Maybe in some cases, the warning is missed, and we send a very long description.

@kpatticha kpatticha merged commit a16dc71 into elastic:main Mar 4, 2025
9 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
apm 2.3MB 2.3MB +96.0B

Page load bundle

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

id before after diff
core 474.7KB 474.9KB +247.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/core-analytics-browser-internal 8 9 +1

Total ESLint disabled count

id before after diff
@kbn/core-analytics-browser-internal 8 9 +1

History

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 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 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants