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] Add feedback form to apm #173758

Merged

Conversation

jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Dec 20, 2023

Closes #172506

Summary

This PR adds a button to all APM pages navigating to a feedback form. The feedback button component exists in infra so in this PR the component is changed to meet the new requirements and moved to observability_shared. Now the feedback button component supports also prefilling the sanitized path (entry.1876422621). The requirements picked for the sanitized path are described in the issue - it should be for example /app/apm/{page_name} if the user is on the page with the exact path matching /app/apm/{page_name} and /app/apm/{page_name}* for all subpages (for example /app/apm/{page_name}/something/else) - different test scenarios can be found in the unit test: get_path_for_feedback.test.ts

Testing

  • Go to APM
  • All APM pages should have a yellow button with the text: Tell us what you think!
  • Hover on the button to see the prefilled properties and check if every property is prefilled
image
  • Click on the form and check if the form is prefilled - The questions that should be prefilled in APM
    • Where is your Elastic cluster deployed? (same as infra)
      • By default, the pre-selected option will be on-prem
      • To test the case with the cloud option preselected add xpack.cloud.id: 'elastic_kibana_dev' to your kibana.dev.yaml
      • To test the serverless option run Kibana in serverless mode (observability config)
    • What version of Elastic are you using? (same as infra)
    • Where in the UI are you?
  • After checking the APM go to the infra pages and check the feedback button/form
test_apm_feedback.mov

@jennypavlova jennypavlova added release_note:skip Skip the PR/issue when compiling release notes apm Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Dec 20, 2023
@jennypavlova jennypavlova self-assigned this Dec 20, 2023
@apmmachine
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.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova jennypavlova added the backport:skip This commit does not require backporting label Dec 20, 2023
@jennypavlova
Copy link
Member Author

/ci

@jennypavlova jennypavlova marked this pull request as ready for review December 21, 2023 10:54
@jennypavlova jennypavlova requested review from a team as code owners December 21, 2023 10:54
@elasticmachine
Copy link
Contributor

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

@crespocarlos crespocarlos self-requested a review December 21, 2023 11:32
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.

Looks good 👏 ! The form is pre-filled as expected. Didn't test all possible combinations though.

Left a few minor coments.

@@ -29,6 +29,9 @@ const HOSTS_FEEDBACK_LINK =

export const HostsPage = () => {
const { isLoading, loadSourceFailureMessage, loadSource, source } = useSourceContext();
const {
services: { kibanaVersion, isCloudEnv, isServerlessEnv },
Copy link
Contributor

Choose a reason for hiding this comment

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

Just realized that kibanaVersion,isCloudEnv, and isServerlessEnv are under services. Should we move them out of the services object? They are just flags and not actual services

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want to have a separate object here in the context for those values? Should we call it kibanaEnvironment or kibanaSettings maybe? (those flags are about the kibana deployment/version so not sure what the best name is 🤔 wdyt?)

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed I picked kibanaEnvironment and added the changes here

Comment on lines 19 to 21
const constructPath = `/${[pathParts[1], pathParts[2], pathParts[3]].join(
'/'
)}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: You could use slice here. Should we be worried if pathParts length is less than 3?

Suggested change
const constructPath = `/${[pathParts[1], pathParts[2], pathParts[3]].join(
'/'
)}`;
const constructPath = `/${pathParts.slice(1, 4)].join(
'/'
)}`;

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed, thanks ✅

};

export const getPathForFeedback = (path: string) => {
const pathStartingFromApp = shortenPath(path, '/app');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a safer way to get this /app ? I tried to find some constant or service that would provide this base path, but couldn't find any

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find it as a constant, I see it is used as a string in other places. I defined a constant here so we can reuse it in case we need to have it somewhere else

Comment on lines 142 to 144
kibanaVersion?: string;
isCloudEnv: boolean;
isServerlessEnv: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not services, is there any other place we can move these flags into?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are inside ApmPluginStartDeps only telemetry is in ApmServices. Indeed, they are not service, where do you think we should put them?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we pass them directly to renderApp?

Copy link
Contributor

@vadimkibana vadimkibana left a comment

Choose a reason for hiding this comment

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

In the long term we are planning to remove the KibanaReactContext utility, so ideally you would not add new functionality to it. Instead you could create a new React context to pass you KibanaEnvironment state.

export const myEnvContext = React.createContext(/* ... */);

@jennypavlova
Copy link
Member Author

In the long term we are planning to remove the KibanaReactContext utility, so ideally you would not add new functionality to it. Instead you could create a new React context to pass you KibanaEnvironment state.

export const myEnvContext = React.createContext(/* ... */);

@vadimkibana Thank you for your review and for letting me know, I didn't know that. I moved the context inside of the plugins. And I reverted the changes inside the KibanaReactContext (as suggested). It's sad that the utility will be removed - do you know if any alternative will be provided? I like the concept of having this shared Kibana context instead of moving it inside the plugins and duplicating part of the logic (Maybe a different shared package or something similar?)

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.

Hey Jenny. I took another look at it, and I'm just concerned about the stuff we're adding to PluginStartDeps, both in infra (possibly tech debt) and now in APM.

If we compare with the rest of the code base, the start deps are supposed to be used for dependencies with other plugins and these flags don't quite fit in this scenario. Might just be me worrying too much, so I'd like to hear your opinion on this.

Comment on lines +422 to +424
isCloudEnv,
isServerlessEnv,
kibanaVersion: this.kibanaVersion,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering whether these could go into a separate object named kibanaEnv or something like that and decouple them from pluginsStart.

The only difference is that in the renderApp we would add another property to apmPluginContextValue.

The same goes for what we currently have in the infra plugin.

My concern is that we're adding things that are not related to plugin dependencies in the pluginsStart object

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for the comments! IMO the Kibana environment data belongs to the KibanaReactContext as it's something related to the Kibana environment and it's not part of the plugin ( as it is the same for all plugins and it's something that we get as a dependency - same as the services and it should be shared ) But based on the comment this context will be removed so I am not sure if we want to keep the concept of sharing a context (as package/utility) and reuse it. I don't know what will replace the KibanaReactContext but it can be a good place to have this environment-specific data independently there.
So you are right that with the last changes is better to get them out of the pluginsStart. I will do that and I think for now we can keep them in the plugin context until we find a better solution.

Copy link
Member Author

Choose a reason for hiding this comment

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

So for both infra and apm now I am passing kibanaEnvironment object separately, can you please take a look again :)

@@ -70,11 +73,15 @@ export const CoreProviders: React.FC<CoreProvidersProps> = ({
pluginStart
);

const MyEnvContextForPluginProvider = useKibanaEnvironmentContextProvider(plugins);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: completely up to you

Suggested change
const MyEnvContextForPluginProvider = useKibanaEnvironmentContextProvider(plugins);
const KibanaEnvContextForPluginProvider = useKibanaEnvironmentContextProvider(plugins);

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks ✅

@jennypavlova jennypavlova force-pushed the 172506-obsux-add-feedback-form-to-apm branch from a8c2a00 to 09d17d5 Compare January 5, 2024 10:01
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.

Looks great! Thanks for making the changes :)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1543 1546 +3
infra 1343 1342 -1
observabilityShared 143 144 +1
total +3

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
observabilityShared 305 307 +2

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.1MB 3.1MB +1.1KB
infra 1.3MB 1.3MB -11.0B
total +1.1KB

Page load bundle

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

id before after diff
apm 34.1KB 34.5KB +413.0B
infra 99.0KB 99.5KB +457.0B
observabilityShared 49.9KB 50.8KB +888.0B
total +1.7KB
Unknown metric groups

API count

id before after diff
observabilityShared 310 312 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jennypavlova

@jennypavlova jennypavlova merged commit 35d037b into elastic:main Jan 5, 2024
20 checks passed
@jennypavlova jennypavlova deleted the 172506-obsux-add-feedback-form-to-apm branch January 5, 2024 13:52
delanni pushed a commit to delanni/kibana that referenced this pull request Jan 11, 2024
Closes elastic#172506

## Summary

This PR adds a button to all APM pages navigating to a feedback form.
The feedback button component exists in infra so in this PR the
component is changed to meet the new requirements and moved to
`observability_shared`. Now the feedback button component supports also
prefilling the sanitized path (`entry.1876422621`). The requirements
picked for the sanitized path are described in the issue - it should be
for example `/app/apm/{page_name}` if the user is on the page with the
exact path matching `/app/apm/{page_name}` and `/app/apm/{page_name}*`
for all subpages (for example `/app/apm/{page_name}/something/else`) -
different test scenarios can be found in the unit test:
[get_path_for_feedback.test.ts](https://github.com/elastic/kibana/compare/main...jennypavlova:kibana:172506-obsux-add-feedback-form-to-apm?expand=1#diff-6396807e61353509c44fa38488dfb741549e60f25126024b92596f6b7ac933b8)

## Testing
- Go to APM
- All APM pages should have a yellow button with the text: `Tell us what
you think!`
- Hover on the button to see the prefilled properties and check if every
property is prefilled
<img width="1920" alt="image"
src="https://github.com/elastic/kibana/assets/14139027/b57adf04-4e7b-42bb-827f-db554dc4a842">

- Click on the form and check if the form is prefilled - The questions
that should be prefilled in APM
   - Where is your Elastic cluster deployed? (same as infra)
      - By default, the pre-selected option will be on-prem
- To test the case with the cloud option preselected add
`xpack.cloud.id: 'elastic_kibana_dev'` to your `kibana.dev.yaml`
- To test the serverless option run Kibana in serverless mode
(observability config)
   - What version of Elastic are you using? (same as infra)
   - Where in the UI are you?
- After checking the APM go to the infra pages and check the feedback
button/form




https://github.com/elastic/kibana/assets/14139027/52cc886f-95a9-4099-b047-93fc64036572
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm 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 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ObsUX] Add feedback form to APM
7 participants