-
Notifications
You must be signed in to change notification settings - Fork 811
Add grafana integration #2844
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
RTJL
wants to merge
18
commits into
DataDog:master
Choose a base branch
from
RTJL:add-grafana-integration
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.
Open
Add grafana integration #2844
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6c34ef8
add implementation and test for grafana integration
RTJL 6243232
remove testing code
RTJL 974c536
fix fmting for the map of promp metrics
RTJL ccca89d
Apply suggestions from code review
RTJL 20b2821
Apply metadata csv suggestions from code review
RTJL 8a8478b
add integration site link for readme
RTJL 1223205
fix linting for ci and codeowners
RTJL c114e4a
remove dashboard from manifest
RTJL 272ec57
fix lint for manifest
RTJL 28d3ba9
delete template dashboard file
RTJL b372a2c
bump the min version of datadog-checks-base pkg
RTJL fc7a6ff
add metric orientation to metadata csv
RTJL a84a309
rename all grafana to Grafana
RTJL bdfff2b
add missing integration[metrics[check]] field for manifest
RTJL 6f40452
add service check metadata
RTJL c0cc98d
add openmetrics health to metrics csv file
RTJL b9d8d5d
update source_type_name for manifest file
RTJL dd7ff20
add changes made by ddev validate ci --sync command
RTJL 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,7 @@ | |
| /go_pprof_scraper/ @nsrip-dd | ||
| /gnatsd/ @stephenprater @jaredhoyt [email protected] | ||
| /gnatsd_streaming/ @stephenprater @jaredhoyt [email protected] | ||
| /grafana/ @rtjl [email protected] | ||
| /gremlin/ [email protected] | ||
| /grpc_check/ @keisku | ||
| /harness_cloud_cost_management/ @akashbdj [email protected] @DataDog/ecosystems-review | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # CHANGELOG - Grafana | ||
|
|
||
| ## 1.0.0 / 2025-11-02 | ||
|
|
||
| ***Added***: | ||
|
|
||
| * Initial Release | ||
|
|
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,65 @@ | ||
| # Agent Check: Grafana | ||
|
|
||
| ## Overview | ||
|
|
||
| Grafana is a multi-platform open source analytics and interactive visualization web application. This check monitors [Grafana][1] through the Datadog Agent. | ||
|
|
||
| ## Setup | ||
|
|
||
| ### Installation | ||
|
|
||
| To install the Grafana check on your host: | ||
|
|
||
| 1. Install the [developer toolkit](https://docs.datadoghq.com/developers/integrations/python/) | ||
| on any machine. | ||
|
|
||
| 2. Run `ddev release build grafana` to build the package. | ||
|
|
||
| 3. [Download the Datadog Agent][2]. | ||
|
|
||
| 4. Upload the build artifact to any host with an Agent and | ||
| run `datadog-agent integration install -w | ||
| path/to/grafana/dist/<ARTIFACT_NAME>.whl`. | ||
|
|
||
| ### Configuration | ||
|
|
||
| 1. Enable the internal Grafana metrics using the [Grafana config file](https://github.com/grafana/grafana/blob/c98259f74a835429ed2db6cca2c64a3802ebc43f/conf/defaults.ini#L1747) | ||
|
|
||
| ``` | ||
| #################################### Internal Grafana Metrics ############ | ||
| # Metrics available at HTTP URL /metrics and /metrics/plugins/:pluginId | ||
| [metrics] | ||
| enabled = true | ||
| ``` | ||
|
|
||
| 2. Edit the `grafana/conf.yaml` file in the `conf.d/` folder at the root of your Agent's configuration directory to start collecting your Grafana metrics. See the [sample grafana/conf.yaml][4] for all available configuration options. | ||
|
|
||
| 3. [Restart the Agent][5]. | ||
|
|
||
| ### Validation | ||
|
|
||
| [Run the Agent's status subcommand][6] and look for `grafana` under the Checks section. | ||
|
|
||
| ## Data Collected | ||
|
|
||
| ### Metrics | ||
|
|
||
| See [metadata.csv][7] for a list of metrics provided by this integration. | ||
|
|
||
| ### Events | ||
|
|
||
| The Grafana integration does not include any events. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| Need help? Contact [Datadog support][3]. | ||
|
|
||
| [1]: https://grafana.com/ | ||
| [2]: https://app.datadoghq.com/account/settings/agent/latest | ||
| [3]: https://docs.datadoghq.com/containers/kubernetes/integrations/ | ||
| [4]: https://github.com/DataDog/integrations-extras/blob/master/grafana/datadog_checks/grafana/data/conf.yaml.example | ||
| [5]: https://docs.datadoghq.com/agent/configuration/agent-commands/#start-stop-and-restart-the-agent | ||
| [6]: https://docs.datadoghq.com/agent/configuration/agent-commands/#agent-status-and-information | ||
| [7]: https://github.com/DataDog/integrations-extras/blob/master/grafana/metadata.csv | ||
| [8]: https://github.com/DataDog/integrations-extras/blob/master/grafana/assets/service_checks.json | ||
| [9]: https://docs.datadoghq.com/help/ | ||
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,17 @@ | ||
| name: Grafana | ||
| files: | ||
| - name: grafana.yaml | ||
| options: | ||
| - template: init_config | ||
| options: | ||
| - template: init_config/default | ||
| - template: instances | ||
| options: | ||
| - template: instances/openmetrics | ||
| overrides: | ||
| openmetrics_endpoint.enabled: true | ||
| openmetrics_endpoint.required: true | ||
| openmetrics_endpoint.value.example: http://127.0.0.1:3000/metrics | ||
| extra_metrics.value.example: | ||
| - grafana_alerting_alertmanager_alerts: alerting.alertmanager_alerts | ||
| - grafana_database_conn_idle: database.conn_idle |
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,16 @@ | ||
| [ | ||
| { | ||
| "agent_version": "7.69.0", | ||
| "integration": "Grafana", | ||
| "check": "grafana.openmetrics.health", | ||
| "statuses": [ | ||
| "ok", | ||
| "critical" | ||
| ], | ||
| "groups": [ | ||
| "endpoint" | ||
| ], | ||
| "name": "Grafana prometheus endpoint health", | ||
| "description": "Returns `CRITICAL` if the check cannot access the metrics endpoint. Returns `OK` otherwise." | ||
| } | ||
| ] |
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 @@ | ||
| __version__ = '1.0.0' |
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,4 @@ | ||
| from .__about__ import __version__ | ||
| from .check import GrafanaCheck | ||
|
|
||
| __all__ = ['__version__', 'GrafanaCheck'] |
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,14 @@ | ||
| from datadog_checks.base import OpenMetricsBaseCheckV2 | ||
|
|
||
| from .metrics import METRIC_MAP | ||
|
|
||
|
|
||
| class GrafanaCheck(OpenMetricsBaseCheckV2): | ||
| __NAMESPACE__ = 'grafana' | ||
| DEFAULT_METRIC_LIMIT = 0 | ||
|
|
||
| def __init__(self, name, init_config, instances): | ||
| super(GrafanaCheck, self).__init__(name, init_config, instances) | ||
|
|
||
| def get_default_config(self): | ||
| return {"metrics": [METRIC_MAP]} |
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,20 @@ | ||
| # This file is autogenerated. | ||
| # To change this file you should edit assets/configuration/spec.yaml and then run the following commands: | ||
| # ddev -x validate config -s <INTEGRATION_NAME> | ||
| # ddev -x validate models -s <INTEGRATION_NAME> | ||
|
|
||
| from .instance import InstanceConfig | ||
| from .shared import SharedConfig | ||
|
|
||
|
|
||
| class ConfigMixin: | ||
| _config_model_instance: InstanceConfig | ||
| _config_model_shared: SharedConfig | ||
|
|
||
| @property | ||
| def config(self) -> InstanceConfig: | ||
| return self._config_model_instance | ||
|
|
||
| @property | ||
| def shared_config(self) -> SharedConfig: | ||
| return self._config_model_shared |
120 changes: 120 additions & 0 deletions
120
grafana/datadog_checks/grafana/config_models/defaults.py
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,120 @@ | ||
| # This file is autogenerated. | ||
| # To change this file you should edit assets/configuration/spec.yaml and then run the following commands: | ||
| # ddev -x validate config -s <INTEGRATION_NAME> | ||
| # ddev -x validate models -s <INTEGRATION_NAME> | ||
|
|
||
|
|
||
| def instance_allow_redirects(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_auth_type(): | ||
| return 'basic' | ||
|
|
||
|
|
||
| def instance_cache_metric_wildcards(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_cache_shared_labels(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_collect_counters_with_distributions(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_collect_histogram_buckets(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_disable_generic_tags(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_empty_default_hostname(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_enable_health_service_check(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_histogram_buckets_as_distributions(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_ignore_connection_errors(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_kerberos_auth(): | ||
| return 'disabled' | ||
|
|
||
|
|
||
| def instance_kerberos_delegate(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_kerberos_force_initiate(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_log_requests(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_min_collection_interval(): | ||
| return 15 | ||
|
|
||
|
|
||
| def instance_non_cumulative_histogram_buckets(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_persist_connections(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_request_size(): | ||
| return 16 | ||
|
|
||
|
|
||
| def instance_skip_proxy(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_tag_by_endpoint(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_telemetry(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_timeout(): | ||
| return 10 | ||
|
|
||
|
|
||
| def instance_tls_ignore_warning(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_tls_use_host_header(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_tls_verify(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_use_latest_spec(): | ||
| return False | ||
|
|
||
|
|
||
| def instance_use_legacy_auth_encoding(): | ||
| return True | ||
|
|
||
|
|
||
| def instance_use_process_start_time(): | ||
| return False |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: troubleshooting contact should refer to the maintainer