-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(ingestion/grafana): Add datasets and charts to dashboards with lineage and tags. Lineage back to source #12417
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
Open
acrylJonny
wants to merge
55
commits into
datahub-project:master
Choose a base branch
from
acrylJonny:grafana-improvements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,196
−192
Open
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
d4be2de
initial commit
acrylJonny 660daf8
Delete grafana2
acrylJonny 6cfbf5f
Merge branch 'master' into grafana-improvements
acrylJonny 23e4eca
second commit
acrylJonny 5468909
updating tests and adding tags and ownership options
acrylJonny e684eed
Merge branch 'master' into grafana-improvements
acrylJonny eda52c4
error updates and better formatting of docs
acrylJonny 507c811
Update grafana_api.py
acrylJonny 0e9f0dc
updating to use basemodel. Cleaning up code
acrylJonny c832e91
test updates
acrylJonny 0fe68d2
Merge branch 'master' into grafana-improvements
acrylJonny c0e63d7
reorder libraries to be alphabetical
acrylJonny 64a3bae
Update grafana_source.py
acrylJonny 09b1ed8
adding unit tests
acrylJonny b06fd12
Merge branch 'master' into grafana-improvements
acrylJonny e0533ad
Adding optionals
acrylJonny 27a9ceb
removing sqlparse requirement
acrylJonny a7e9e19
test updates
acrylJonny 4714b24
Merge branch 'master' into grafana-improvements
acrylJonny f0f88c6
Merge branch 'master' into grafana-improvements
acrylJonny 7646b89
addressing comments
acrylJonny 6bd09ed
Merge branch 'master' into grafana-improvements
acrylJonny 51310f9
addressing comments
acrylJonny 54d142f
Improving overall experience
acrylJonny b4b7409
Merge branch 'master' into grafana-improvements
acrylJonny b4da306
Update constants.ts
acrylJonny 40b75b8
Merge branch 'grafana-improvements' of https://github.com/acrylJonny/…
acrylJonny 9bd5e7d
Merge branch 'master' into grafana-improvements
acrylJonny 1dbe6f9
Update grafana_pre.md
acrylJonny 8e150cd
test file updates
acrylJonny addfd15
Merge branch 'master' into grafana-improvements
acrylJonny 40c2ff9
Merge branch 'master' into grafana-improvements
acrylJonny ac2e4cd
Merge branch 'master' into grafana-improvements
acrylJonny 19fb94a
Merge branch 'master' into grafana-improvements
acrylJonny a51d77c
Update constants.ts
acrylJonny 018f60f
Merge branch 'master' into grafana-improvements
acrylJonny 3379e2f
Merge branch 'master' into grafana-improvements
acrylJonny f9c6232
Merge branch 'master' into grafana-improvements
acrylJonny 624dcf4
Update sources.json
acrylJonny 733b70e
prettier
acrylJonny ac9ec8e
Merge branch 'master' into grafana-improvements
acrylJonny 5ca19f4
addressing feedback
acrylJonny 1de957b
Merge branch 'master' into grafana-improvements
acrylJonny 6dd0c05
addressing final feedback
acrylJonny 7f678c4
Update metadata-ingestion/docs/sources/grafana/grafana_pre.md
acrylJonny e17fbaf
Merge branch 'master' into grafana-improvements
acrylJonny c5e2e26
Merge branch 'master' into grafana-improvements
acrylJonny a8b0cbb
addressing comments
acrylJonny 4386c1b
Update capability_summary.json
acrylJonny 88e1c64
Update grafana_pre.md
acrylJonny 40cd2a9
adding comments - improve structuring
acrylJonny 2171e1b
linting
acrylJonny 835fd1c
more robust docker setup
acrylJonny 877c50c
Merge branch 'master' into grafana-improvements
acrylJonny b3f829c
Update capability_summary.json
acrylJonny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
### Concept Mapping | ||
|
||
| Source Concept | DataHub Concept | Notes | | ||
| --------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------ | | ||
| `"grafana"` | [Data Platform](../../metamodel/entities/dataPlatform.md) | | | ||
| Grafana Folder | [Container](../../metamodel/entities/container.md) | Subtype `Folder` | | ||
| Grafana Dashboard | [Container](../../metamodel/entities/container.md) | Subtype `Dashboard` | | ||
| Grafana Panel/Visualization | [Chart](../../metamodel/entities/chart.md) | Various types mapped based on panel type (e.g., graph → LINE, pie → PIE) | | ||
| Grafana Data Source | [Dataset](../../metamodel/entities/dataset.md) | Created for each panel's data source | | ||
| Dashboard Owner | [Corp User](../../metamodel/entities/corpuser.md) | Derived from dashboard UID and creator | | ||
| Dashboard Tags | [Tag](../../metamodel/entities/tag.md) | Supports both simple tags and key:value tags | | ||
|
||
### Compatibility | ||
|
||
The connector supports extracting metadata from any Grafana instance accessible via API. For SQL-based data sources, column-level lineage can be extracted when the queries are parseable. The connector supports various panel types and their transformations, and can work with both standalone Grafana instances and those integrated with other platforms. | ||
|
||
For optimal lineage extraction from SQL-based data sources: | ||
|
||
- Database/schema information should be properly configured in the connection settings | ||
- The platform mapping (`connection_to_platform_map`) should be configured to match your data sources | ||
|
||
### Prerequisites: | ||
|
||
The Grafana source supports two extraction modes based on your permission level: | ||
|
||
#### Enhanced Mode (Default) | ||
|
||
For full metadata extraction including lineage, containers, and detailed panel information: | ||
|
||
1. A running Grafana instance | ||
2. A service account token with **Admin permissions** to: | ||
- Read dashboards and folders | ||
- Access data source configurations | ||
- View user information | ||
- Access detailed dashboard metadata | ||
- Read panel configurations and transformations | ||
|
||
#### Basic Mode (Limited Permissions) | ||
|
||
For users with limited permissions who only need basic dashboard metadata: | ||
|
||
1. A running Grafana instance | ||
2. A service account token with **Viewer permissions** to: | ||
- Read dashboards (via `/api/search` endpoint) | ||
- Basic dashboard metadata access | ||
|
||
To enable basic mode, set `basic_mode: true` in your configuration. This provides backwards compatibility with the original simple connector behavior. | ||
|
||
**Note:** Basic mode extracts only dashboard entities without folder hierarchy, panel details, lineage information, or schema metadata. It's recommended to use enhanced mode when possible for complete metadata extraction. | ||
|
||
#### Configuration Examples | ||
|
||
Enhanced Mode (Default): | ||
|
||
```yaml | ||
source: | ||
type: grafana | ||
config: | ||
url: "https://grafana.company.com" | ||
service_account_token: "your_admin_token" | ||
# basic_mode: false # Default - full extraction | ||
``` | ||
|
||
Basic Mode (Limited Permissions): | ||
|
||
```yaml | ||
source: | ||
type: grafana | ||
config: | ||
url: "https://grafana.company.com" | ||
service_account_token: "your_viewer_token" | ||
basic_mode: true # Enable basic mode for limited permissions | ||
``` | ||
|
||
#### Lineage Configuration | ||
|
||
The Grafana source can extract lineage information between charts and their data sources. You can control lineage extraction using these configuration options: | ||
|
||
```yaml | ||
source: | ||
type: grafana | ||
config: | ||
url: "https://grafana.company.com" | ||
service_account_token: "your_token" | ||
|
||
# Lineage extraction (default: true) | ||
include_lineage: true | ||
|
||
# Column-level lineage from SQL queries (default: true) | ||
# Only applicable when include_lineage is true | ||
include_column_lineage: true | ||
|
||
# Platform mappings for lineage extraction | ||
connection_to_platform_map: | ||
postgres_datasource_uid: | ||
platform: postgres | ||
platform_instance: my_postgres | ||
env: PROD | ||
database: analytics | ||
database_schema: public | ||
``` | ||
|
||
**Lineage Features:** | ||
|
||
- **Dataset-level lineage**: Links charts to their underlying data sources | ||
- **Column-level lineage**: Extracts field-to-field relationships from SQL queries | ||
- **Platform mapping**: Maps Grafana data sources to their actual platforms for accurate lineage | ||
- **SQL parsing**: Supports parsing of SQL queries for detailed lineage extraction | ||
|
||
**Performance Note:** Lineage extraction can be disabled (`include_lineage: false`) to improve ingestion performance when lineage information is not needed. |
26 changes: 26 additions & 0 deletions
26
metadata-ingestion/docs/sources/grafana/grafana_recipe.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
source: | ||
type: grafana | ||
config: | ||
# Coordinates | ||
platform_instance: production # optional | ||
env: PROD # optional | ||
url: https://grafana.company.com | ||
service_account_token: ${GRAFANA_SERVICE_ACCOUNT_TOKEN} | ||
|
||
# SSL verification for HTTPS connections | ||
verify_ssl: true # optional, default is true | ||
|
||
# Source type mapping for lineage | ||
connection_to_platform_map: | ||
postgres: | ||
platform: postgres | ||
database: grafana # optional | ||
database_schema: grafana # optional | ||
platform_instance: database_2 # optional | ||
env: PROD # optional | ||
mysql_uid_1: # Grafana datasource UID | ||
platform: mysql | ||
platform_instance: database_1 # optional | ||
database: my_database # optional | ||
sink: | ||
# sink configs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.