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

[Observability Onboarding] Auto-detect flow #186106

Merged
merged 24 commits into from
Jun 24, 2024

Conversation

thomheymann
Copy link
Contributor

@thomheymann thomheymann commented Jun 12, 2024

Resolves #183362

Summary

Implements auto-detect based onboarding flow.
The new flow can only be accessed behind a hidden URL: /app/observabilityOnboarding/auto-detect?category=logs

Screenshots

Kibana

Screenshot 2024-06-12 at 16 05 54

Terminal

Screenshot 2024-06-12 at 16 07 32

@thomheymann thomheymann added release_note:skip Skip the PR/issue when compiling release notes Feature: Observability Onboarding labels Jun 12, 2024
@obltmachine
Copy link

🤖 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!)

@thomheymann
Copy link
Contributor Author

/ci

@thomheymann
Copy link
Contributor Author

/ci

@thomheymann
Copy link
Contributor Author

/ci

@thomheymann
Copy link
Contributor Author

/ci

@thomheymann
Copy link
Contributor Author

/ci

@thomheymann thomheymann marked this pull request as ready for review June 18, 2024 20:33
@thomheymann thomheymann requested review from a team as code owners June 18, 2024 20:33
@thomheymann
Copy link
Contributor Author

/ci

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

Other than that this looks pretty good to me - there are some components that can also be useful for the otel flow, but we can consolidate that after everything is merged

@thomheymann
Copy link
Contributor Author

This is the payload:

{"statusCode":400,"error":"Bad Request","message":"uri [/internal/observability_onboarding/flow/9f859b08-8212-445d-aeeb-b6540ebc9fc4/integrations/install] with method [post] exists but is not available with the current configuration"}

Maybe we need to change something for serverless in particular?

Ah, good catch. I think the curl command was missing some required internal request headers. I've added them in now.

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Really cool, left some high level comments

The install went through now, but the call to update the status to "complete" seems to have been run into a connection timeout:
Screenshot 2024-06-21 at 10 53 42

Not sure whether that was a problem with our serverless setup or something inherent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note - also added that as part of #183732

title={i18n.translate(
'xpack.observability_onboarding.autoDetectPanel.h3.getStartedWithNginxLabel',
{
defaultMessage: 'Get started with {pkgName} logs',
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the title of the integration instead of the technical name?

<ul>
{integration.kibanaAssets
.filter((asset) => asset.type === 'dashboard')
.map((dashboard) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all of them will be relevant (e.g. we don't support windows). I'm aware there is no easy way to tell which ones matter to the current user - if we can't come up with something I think it's not a big issue either

Screenshot 2024-06-21 at 10 46 41

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeh, we need a way of establishing which dashboard is the main one we want to present. Usually there's an "overview" dashboard that can be considered the best entry point so we might be able to do a naive pattern matching.

Ideally there would also be a way of determining whether a dashboard is relevant in the first place (e.g. whether it contains any data) but I'm not sure this can be easily done currently.

I think this panel needs another design iteration where we look at what information is returned from fleet for each of the supported integrations and then how we want to present that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, could you prepare that discussion for our next sync?

Choose a reason for hiding this comment

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

I agree we should have some logic on which dashboard should be the one we want to show and group the rest on the link to see all of them. As mentioned, usually there is an Overview. In this case we'll need to evaluate host vs system metrics overview dashboards.

<LocatorButtonEmpty<DashboardLocatorParams>
locator={DASHBOARD_APP_LOCATOR}
params={{ dashboardId: dashboard.id }}
target="_blank"
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 it's great opening in a new tab! However, when using it I didn't trust it because there's no indication this will happen, should we append a suitable icon to the end?

Copy link
Contributor

Choose a reason for hiding this comment

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

Adds some visual noise as well though, so not 100% sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, buttons can only have one icon. It think it would be too confusing otherwise.

We could change the icon to an external link icon on the right hand side but then we would have to remove the current icons

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's discuss with @sileschristian once he's back - no strong opinion on it

Choose a reason for hiding this comment

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

@thomheymann

We could change the icon to an external link icon on the right hand side but then we would have to remove the current icons

This makes sense. Let's do this. Dashboard icon is not bringing that much of value. Also, we are missing a copy that we usually we had before the link that gives better context.

image

Copy link
Contributor

@mykolaharmash mykolaharmash 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, just a few minor comments

<EuiIcon type={iconType} size="l" />
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle size="xs" css={rest.isDisabled ? { color: 'inherit' } : undefined}>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: better to have isDisabled as a de-structured prop as you use it directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But then I would also have to manually pass it into accordion. Leaving it inside rest means it will get spread with the rest of the props that are just pass through props from the EuiAccordion.

Comment on lines +58 to +83
const assetsState = useAsync(async () => {
if (installedIntegrations.length === 0) {
return [];
}
const assetsMetadata = await fleet.hooks.epm.getBulkAssets({
assetIds: installedIntegrations
.map((integration) => integration.kibanaAssets)
.flat() as AssetSOObject[],
});
return installedIntegrations.map((integration) => {
return {
...integration,
// Enrich installed Kibana assets with metadata from Fleet API (e.g. title, description, etc.)
kibanaAssets: integration.kibanaAssets.reduce<GetBulkAssetsResponse['items']>(
(acc, asset) => {
const assetWithMetadata = assetsMetadata.data?.items.find(({ id }) => id === asset.id);
if (assetWithMetadata) {
acc.push(assetWithMetadata);
}
return acc;
},
[]
),
};
});
}, [installedIntegrations.length]); // eslint-disable-line react-hooks/exhaustive-deps
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a personal preference, no need for changes, but I'd keep metadata as a separate structure and let each installed integration look up stuff there while rendering.

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 drawback of that approach would be that you'd be making multiple unecessary HTTP requests for each integration separately to load that metadata in. Happy to refactor at a later stage if this causes issues but gonna keep as is for now

@flash1293
Copy link
Contributor

I guess you planned to do this anyway, but happy to merge it in in a hidden way so testing becomes easier and then do the polishing in a follow-up PR.

@thomheymann
Copy link
Contributor Author

I guess you planned to do this anyway, but happy to merge it in in a hidden way so testing becomes easier and then do the polishing in a follow-up PR.

I have already removed the auto detection card so the flow is only accessible via the hidden URL

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 24, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityOnboarding 201 215 +14

Async chunks

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

id before after diff
observabilityOnboarding 200.2KB 209.1KB +8.9KB
Unknown metric groups

ESLint disabled line counts

id before after diff
observabilityOnboarding 14 15 +1

References to deprecated APIs

id before after diff
observabilityOnboarding 1 3 +2

Total ESLint disabled count

id before after diff
observabilityOnboarding 18 19 +1

History

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

@thomheymann thomheymann merged commit f015066 into elastic:main Jun 24, 2024
24 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels Jun 24, 2024
mykolaharmash added a commit that referenced this pull request Jul 10, 2024
Depends on: elastic/elastic-agent#4754
Depends on: #186106
Closes: #182407

## Summary

Adds a Kubernetes onboarding quick start flow using `kubectl kustomize`
command.
![CleanShot 2024-06-18 at 15 10
27@2x](https://github.com/elastic/kibana/assets/793851/522d2481-6a0e-43d3-b9ef-d09ee9953b3c)

## How to test
1. Run Kibana and ES locally (make sure to expose ES on 0.0.0.0 so
elastic agent can reach it from within a container, I use this command
`yarn es snapshot --license trial -E
xpack.security.authc.api_key.enabled=true -E http.host=0.0.0.0`)
2. Setup a test cluster with
[minikube](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download)
3. Open Kibana and navigate to the Onboarding screen
4. Make sure Kubernetes quick start card is visible under the
infrastructure category and click on it
5. Copy the command snippet
6. Paste the command into a terminal, but don't run it yet
7. Replace `localhost` in the command with you local IP `ipconfig
getifaddr en0`
8. In case elastic/elastic-agent#4754 was not
merged yet, you'd need to also clone the elastic-agent repo and replace
the template URL with a local path to the
`elastic-agent-kustomize/default/elastic-agent-standalone` folder.
9. Run the command and make sure all resources were created
10. Go back to Kibana, after ~1 minute UI should identify that the data
was ingested
11. Click on the cluster overview link and make sure it works

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 10, 2024
Depends on: elastic/elastic-agent#4754
Depends on: elastic#186106
Closes: elastic#182407

## Summary

Adds a Kubernetes onboarding quick start flow using `kubectl kustomize`
command.
![CleanShot 2024-06-18 at 15 10
27@2x](https://github.com/elastic/kibana/assets/793851/522d2481-6a0e-43d3-b9ef-d09ee9953b3c)

## How to test
1. Run Kibana and ES locally (make sure to expose ES on 0.0.0.0 so
elastic agent can reach it from within a container, I use this command
`yarn es snapshot --license trial -E
xpack.security.authc.api_key.enabled=true -E http.host=0.0.0.0`)
2. Setup a test cluster with
[minikube](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download)
3. Open Kibana and navigate to the Onboarding screen
4. Make sure Kubernetes quick start card is visible under the
infrastructure category and click on it
5. Copy the command snippet
6. Paste the command into a terminal, but don't run it yet
7. Replace `localhost` in the command with you local IP `ipconfig
getifaddr en0`
8. In case elastic/elastic-agent#4754 was not
merged yet, you'd need to also clone the elastic-agent repo and replace
the template URL with a local path to the
`elastic-agent-kustomize/default/elastic-agent-standalone` folder.
9. Run the command and make sure all resources were created
10. Go back to Kibana, after ~1 minute UI should identify that the data
was ingested
11. Click on the cluster overview link and make sure it works

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 141e619)
pgayvallet pushed a commit to pgayvallet/kibana that referenced this pull request Jul 11, 2024
Depends on: elastic/elastic-agent#4754
Depends on: elastic#186106
Closes: elastic#182407

## Summary

Adds a Kubernetes onboarding quick start flow using `kubectl kustomize`
command.
![CleanShot 2024-06-18 at 15 10
27@2x](https://github.com/elastic/kibana/assets/793851/522d2481-6a0e-43d3-b9ef-d09ee9953b3c)

## How to test
1. Run Kibana and ES locally (make sure to expose ES on 0.0.0.0 so
elastic agent can reach it from within a container, I use this command
`yarn es snapshot --license trial -E
xpack.security.authc.api_key.enabled=true -E http.host=0.0.0.0`)
2. Setup a test cluster with
[minikube](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download)
3. Open Kibana and navigate to the Onboarding screen
4. Make sure Kubernetes quick start card is visible under the
infrastructure category and click on it
5. Copy the command snippet
6. Paste the command into a terminal, but don't run it yet
7. Replace `localhost` in the command with you local IP `ipconfig
getifaddr en0`
8. In case elastic/elastic-agent#4754 was not
merged yet, you'd need to also clone the elastic-agent repo and replace
the template URL with a local path to the
`elastic-agent-kustomize/default/elastic-agent-standalone` folder.
9. Run the command and make sure all resources were created
10. Go back to Kibana, after ~1 minute UI should identify that the data
was ingested
11. Click on the cluster overview link and make sure it works

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@amolnater-qasource
Copy link

Hi @gbamparop

We have revalidated this script on 8.15.0 BC2 kibana cloud environment available by adding /app/observabilityOnboarding/auto-detect?category=logs to the URL.

Build details:

VERSION: 8.15.0 BC2
BUILD: 76111
COMMIT: 8d6510f30e7a52246ccebbf7d913a59b498c3bc2

Platforms:

  • Ubuntu 24.04
  • SLES 15
  • MAC Sonoma 14.5

Observations:

  1. Steps gets updated in the CLI on running the available command and similarly the flow gets completed under UI.
  2. We are successfully able to run the script on Linux and Mac platforms.
  3. Data is generated for the installed agent and Dashboards are created as per the integrations.
  4. Further, currently the script isn't testable on Windows due to && sudo in the command.

SLES15:
image

3

Ubuntu 24.04:
image

6
7
8

MAC Sonoma 14.5:
image

Elastic - Google Chrome 2024-07-17 11-56-30.zip

Error on Windows:
image

Please let us know if we are missing anything here.

Thanks!!

@flash1293
Copy link
Contributor

Thanks for testing @amolnater-qasource !

The windows case is expected for now - could you test with apache, nginx and docker being installed on mac and linux as well to make sure the detection and data collection works as expected for these as well?

@amolnater-qasource
Copy link

amolnater-qasource commented Jul 17, 2024

Hi @flash1293

Thank you for the update.

We have installed apache, nginx and docker on the linux and mac. Please find below detailed observations.

Observations:

Linux:

  • Able to view dashboards for all the 3 installations with linux host data present in it.

Screen Recording:

Elastic.-.Google.Chrome.2024-07-17.15-54-27.mp4

MAC:

  • Further on mac when we have installed the agent no dashboards for any of these services are available on UI.

Screenshot:
image
11
image
12
13

Please let us know if we are missing anything here.

Thanks!!

@flash1293
Copy link
Contributor

flash1293 commented Jul 17, 2024

Thanks for checking @amolnater-qasource - I think the detection we built for nginx, apache and docker doesn't work for the way these are installed on mac, I will check back with the team.

@thomheymann
Copy link
Contributor Author

@flash1293 The paths we use in the script are based on the ones provided by EPM. For docker that is:

  - id: filestream-docker
    type: filestream
    streams:
      - id: 'docker-container-logs-${docker.container.name}-${docker.container.id}'
        data_stream:
          dataset: docker.container_logs
          type: logs
          elasticsearch:
            dynamic_dataset: true
            dynamic_namespace: true
        paths:
          - '/var/lib/docker/containers/${docker.container.id}/*-json.log'
        parsers:
          - container:
              stream: all
              format: docker

It looks like Docker desktop on macOS does not use the same paths.
This would be an issue with the existing Elastic Agent / Fleet flow as well but I guess it's made worse in our case since we're claiming that we can auto-detect these apps. I wonder if we need to add additional known log file paths or if we should be smarter with the detection and look for running processes or knowns commands in the PATH.

@flash1293
Copy link
Contributor

flash1293 commented Jul 26, 2024

This would be an issue with the existing Elastic Agent / Fleet flow as well but I guess it's made worse in our case since we're claiming that we can auto-detect these apps.

Right, the claim right above is the main concern - it's just something the integration can't do today.

I wonder if we need to add additional known log file paths or if we should be smarter with the detection and look for running processes or knowns commands in the PATH.

In general, in docker desktop the log files aren't even in the file system of the host by default, so it's not easily possible to collect them in the first place. In theory it's possible to get the logs via the /var/run/docker.sock socket instead of consuming files, but that would be a much larger change to the docker integration - if that would be available, we could detect docker by the presence of the socket instead of looking for certain files. Right now, we could do this detection strategy too, but then it would only get the docker metrics (which are collected through the socket), not the docker logs.

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 Feature: Observability Onboarding release_note:skip Skip the PR/issue when compiling release notes v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Observability Onboarding] Implement Kibana flow
9 participants