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

[Fleet] POC - Add support for OTEL policies and integrations #193889

Closed
wants to merge 5 commits into from

Conversation

criamico
Copy link
Contributor

@criamico criamico commented Sep 24, 2024

Summary

🚧 🚧 POC - DO NOT MERGE! 🚧 🚧

Experimental API support of OTEL policies and integrations in Fleet UI

Create new OTEL integration

This endpoint allows to load a yml file containing the configs. The content is parsed to json and saved in a new SO. THis is just a way to "mock" the installation of an OTEL integration.

Usage:

curl -XPOST -H 'content-type: text/x-yaml' -H 'kbn-xsrf: true' http://localhost:5601/cri/api/fleet/otel/integrations/prometheus -u elastic:changeme --data-binary @prometheus.yml

Verify that it's saved with GET .kibana_ingest/_search?q=type:fleet-otel-integrations

Create new OTEL policy

This endpoint allows to create a new OTEL policy.

POST kbn:api/fleet/otel/policies
{
  "name": "otel-policy-2",
  "description": "Otel policy",
  "policy_ids": ["6b323736-5916-445e-a599-5c5dc5152795"],
  "integration": {
    "name": "prometheus"
  },
  "vars": {
    "access_paths": ["/var/log/nginx/access*.log"],
    "error_paths": ["/var/log/nginx/error*.log"],
    "endpoint": "http://localhost:80/status"
  },
  "pipelines": [
    "status"
  ]
}

Verify that it's saved with GET .kibana_ingest/_search?q=type:fleet-otel-policies

Retrieve full agent policy

The generated config is nested under inputs and merged with the regular inputs. It also retrieves the "installed" template from the fleet/otel/integrations and adds it under extensions. This is something that can be changed easily if needed.
Screenshot 2024-09-26 at 17 14 25

Considerations

This is by no means production ready code. It needs some additional things:

  • exporters that take the ES outputs and parses it to the correct OTEL format
  • some metadata for the agent, which can easily be added to the Otel policy

Also the code organization needs to be improved, I hacked my way trough the code to make the POC work :)

@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!

@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label Sep 24, 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!)

version: { type: 'keyword' },
},
},
vars: { type: 'flattened' },
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, does flattened work for complex data types? Or we do some additional processing for these when reading the saved object?

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 it works well for complex data types and it doesn't need additional processing. We're already using it for existing mappings.

@criamico
Copy link
Contributor Author

criamico commented Oct 3, 2024

Closing as the POC is considered completed

@criamico criamico closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants