Skip to content

[New Package] Add Grafana integration#17433

Open
Oddly wants to merge 1 commit intoelastic:mainfrom
Oddly:add-grafana-integration
Open

[New Package] Add Grafana integration#17433
Oddly wants to merge 1 commit intoelastic:mainfrom
Oddly:add-grafana-integration

Conversation

@Oddly
Copy link
Contributor

@Oddly Oddly commented Feb 17, 2026

New integration for collecting logs and Prometheus metrics from Grafana instances (10.x, 11.x, 12.x). Includes ingest pipelines for both JSON and logfmt log formats, field mappings that rename prometheus.metrics.* to a structured grafana.* namespace, two Kibana dashboards (overview and logs), and pipeline tests with data captured from a real Grafana 12.3.2 instance.

Proposed commit message

This adds a new grafana integration package with two data streams: logs and metrics.

The logs data stream reads Grafana server log files. The ingest pipeline handles both JSON and logfmt formats — it tries JSON parsing first and falls back to logfmt via grok. Both formats are supported across Grafana 10, 11, and 12 since the field names are identical across those versions. The pipeline extracts HTTP request fields (method, path, status, duration, remote_addr), maps log levels to ECS severity values, and populates the grafana.log.* namespace.

The metrics data stream scrapes Grafana's Prometheus /metrics endpoint using the prometheus/metrics input type. The ingest pipeline renames prometheus.metrics.* fields into a structured grafana.* namespace — instance stats go to grafana.stat.*, database connection pool metrics to grafana.database.connections.*, Go runtime to grafana.go.*, and so on. There are explicit renames for about 100 known metrics, plus a catch-all painless script that handles any remaining metrics by convention.

Two Kibana dashboards are included: an overview dashboard showing instance stats, resource usage, database connections, and alerting status, and a logs dashboard with log volume over time, level breakdown, top error messages, HTTP status codes, and a log stream panel.

Pipeline test fixtures use real data captured from a Grafana 12.3.2 instance. The metrics tests cover three versions (v10, v11, v12) with progressively more metrics present in each, reflecting the additive nature of Grafana's metric surface across major versions.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • elastic-package lint passes
  • elastic-package build succeeds
  • All 10 pipeline tests pass (elastic-package test pipeline)
  • Sample events reflect post-pipeline field structure
  • Tested with live Grafana 12.3.2 instance — logs and metrics both index correctly and dashboards render

How to test this PR locally

cd packages/grafana
elastic-package test pipeline

For a full end-to-end test with a running Grafana instance:

elastic-package stack up -v -d
elastic-package test system

Or point the agent at any Grafana instance with metrics enabled (GF_METRICS_ENABLED=true) and a log file path configured. Both logfmt (default) and JSON (GF_LOG_FILE_FORMAT=json) log formats are handled automatically.

Related issues

Screenshots

[Grafana] Overview Dashboard
Overview Dashboard

[Grafana] Logs Dashboard
Logs Dashboard

New integration for collecting logs and Prometheus metrics from Grafana
instances (10.x, 11.x, 12.x). Includes ingest pipelines for both JSON
and logfmt log formats, field mappings that rename prometheus.metrics.*
to a structured grafana.* namespace, two Kibana dashboards (overview
and logs), and pipeline tests with data captured from a real Grafana
12.3.2 instance.
@Oddly Oddly requested a review from a team as a code owner February 17, 2026 00:44
@elastic-vault-github-plugin-prod

Reviewers

Buildkite won't run for external contributors automatically; you need to add a comment:

  • /test : will kick off a build in Buildkite.

NOTE: https://github.com/elastic/integrations/blob/main/.buildkite/pull-requests.json contains all those details.

@Oddly Oddly changed the title Add Grafana integration [New Package] Add Grafana integration Feb 17, 2026
@Oddly
Copy link
Contributor Author

Oddly commented Feb 17, 2026

/test

@lalit-satapathy
Copy link
Contributor

@claude for detailed initial review, as a new package all requirements to be met.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Claude finished @lalit-satapathy's task in 3m 6s —— View job


Detailed Review of New Grafana Integration Package

I've completed a thorough review of this new Grafana integration package. The review has been submitted formally on the PR.

Summary:

  • ✅ Package passes elastic-package lint and elastic-package build
  • ✅ All major new package requirements are met
  • 🟡 One medium-severity issue: changelog PR link needs to be updated to [New Package] Add Grafana integration #17433

See the formal review for complete details.



Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a well-structured new integration package for Grafana. I've reviewed the package against integration requirements and found it to be comprehensive.

✅ Requirements Met

  • Package manifest: Format version 3.3.0, proper categories (observability, monitoring), Kibana version constraint ^8.16.0 || ^9.0.0
  • Data streams: Both logs and metrics properly configured with correct input types (logfile, prometheus/metrics)
  • Ingest pipelines: Comprehensive handling of both JSON and logfmt log formats, proper Prometheus metric renaming
  • Field definitions: Fields are properly typed with metric types (gauge/counter) and units where applicable
  • Pipeline tests: Coverage across Grafana versions 10, 11, and 12, plus both log formats
  • Time series support: Metrics manifest correctly enables index_mode: time_series
  • Dashboards: Two dashboards covering overview metrics and log analysis
  • Documentation: README with setup instructions and field reference tables
  • Icons/Screenshots: Logo SVG and dashboard screenshots included
  • Docker-compose: Proper test setup with healthcheck

🔬 Verification

  • elastic-package lint ✅ passes
  • elastic-package build ✅ succeeds

💡 Optional Improvements

  1. The logs dashboard "eror" query filter (log.level: eror) handles Grafana's unique spelling, but consider normalizing erorerror in the ingest pipeline for consistency in searches
  2. The stat.data_keys.total field is defined in fields.yml but not covered in pipeline test fixtures

Overall this is a quality integration ready for merge after addressing the changelog PR link.


Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

changes:
- description: Initial release with metrics and logs data streams.
type: enhancement
link: https://github.com/elastic/integrations/pull/1
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 MEDIUM PR link references pull/1

Why: The changelog link should point to the actual PR number for traceability

Suggested change
link: https://github.com/elastic/integrations/pull/1
link: https://github.com/elastic/integrations/pull/17433

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants