PackageJson: Prettify markdown/mdx on commit with lint-staged (#37616)

* Format md,mdx files with prettier on lint-staged

* Manually run prettier on docs/sources
This commit is contained in:
Connor Lindsey
2021-08-06 07:52:36 -06:00
committed by GitHub
parent e9c032f10f
commit b78a67cec7
301 changed files with 3216 additions and 2980 deletions
@@ -8,14 +8,16 @@ weight = 200
# Usage insights
Usage insights allow you to have a better understanding of how your Grafana instance is used.
Usage insights allow you to have a better understanding of how your Grafana instance is used.
The usage insights feature collects a number of aggregated data and stores them in the database:
- Dashboard views (aggregated and per user)
- Data source errors
- Data source queries
These aggregated data give you access to several features:
- [Dashboard and data source insights]({{< relref "dashboard-datasource-insights.md" >}})
- [Presence indicator]({{< relref "presence-indicator.md" >}})
- [Sort dashboards by using insights data]({{< relref "improved-search.md" >}})
@@ -36,6 +36,7 @@ Data source insights give you information about how a data source has been used
- Query load time per day (averaged in ms)
To find data source insights:
1. Go to the Data source list view.
1. Click on a data source.
1. Click the **Insights** tab.
@@ -15,6 +15,7 @@ By exporting usage logs to Loki, you can directly query them and create dashboar
## Usage insights logs
Usage insights logs are JSON objects that represent certain user activities, such as:
- A user opens a dashboard.
- A query is sent to a data source.
@@ -23,7 +24,8 @@ Usage insights logs are JSON objects that represent certain user activities, suc
A log is created every time a user opens a dashboard or when a query is sent to a data source in the dashboard view. A query that is performed via Explore does not generate a log.
### Format
Logs of usage insights contain the following fields, where the fields followed by * are always available, and the others depend on the logged event:
Logs of usage insights contain the following fields, where the fields followed by \* are always available, and the others depend on the logged event:
| Field name | Type | Description |
| ---------- | ---- | ----------- |
| `eventName`\* | string | Type of the event, which can be either `data-request` or `dashboard-view`. |
@@ -69,11 +71,12 @@ tls = true
## Visualize Loki usage insights in Grafana
Now that your logs are exported into Loki, you can build Grafana dashboards to understand your Grafana instance usage.
1. Add Loki as a data source. Refer to [Grafana fundamentals tutorial](/tutorials/grafana-fundamentals/#6).
1. Import one of the following dashboards:
* [Usage insights](/grafana/dashboards/13785)
* [Usage insights datasource details](/grafana/dashboards/13786)
- [Usage insights](/grafana/dashboards/13785)
- [Usage insights datasource details](/grafana/dashboards/13786)
1. Play with usage insights to understand them:
* In Explore, you can use the query `{datasource="gdev-loki",kind="usage_insights"}` to retrieve all logs related to your `gdev-loki` data source.
* In a dashboard, you can build a table panel with the query `topk(10, sum by (error) (count_over_time({kind="usage_insights", datasource="gdev-prometheus"} | json | error != "" [$__interval])))` to display the 10 most common errors your users see using the `gdev-prometheus` data source.
* In a dashboard, you can build a graph panel with the queries `sum by(host) (count_over_time({kind="usage_insights"} | json | eventName="data-request" | error != "" [$__interval]))` and `sum by(host) (count_over_time({kind="usage_insights"} | json | eventName="data-request" | error = "" [$__interval]))` to show the evolution of the data request count over time. Using `by (host)` allows you to have more information for each Grafana server you have if you have set up Grafana for [high availability](<{{< relref "../../administration/set-up-for-high-availability.md" >}}>).
- In Explore, you can use the query `{datasource="gdev-loki",kind="usage_insights"}` to retrieve all logs related to your `gdev-loki` data source.
- In a dashboard, you can build a table panel with the query `topk(10, sum by (error) (count_over_time({kind="usage_insights", datasource="gdev-prometheus"} | json | error != "" [$__interval])))` to display the 10 most common errors your users see using the `gdev-prometheus` data source.
- In a dashboard, you can build a graph panel with the queries `sum by(host) (count_over_time({kind="usage_insights"} | json | eventName="data-request" | error != "" [$__interval]))` and `sum by(host) (count_over_time({kind="usage_insights"} | json | eventName="data-request" | error = "" [$__interval]))` to show the evolution of the data request count over time. Using `by (host)` allows you to have more information for each Grafana server you have if you have set up Grafana for [high availability](<{{< relref "../../administration/set-up-for-high-availability.md" >}}>).
@@ -13,6 +13,7 @@ weight = 400
In the search view, you can sort dashboards by using insights data. Doing so helps you find unused or broken dashboards or discover those that are most viewed.
There are several sort options:
- Errors total
- Errors 30 days
- Views total
@@ -12,7 +12,7 @@ weight = 300
When you are signed in and looking at any given dashboard, you can know who is looking at the same dashboard as you are via a presence indicator, which displays avatars of users who have interacted with the dashboard recently. The default time frame is within the past 10 minutes. To see the user's name, hover over the user's avatar. The avatars come from [Gravatar](https://gravatar.com) based on the user's email.
When there are more active users on a dashboard than can fit within the presence indicator, click the **+X** icon. Doing so opens [dashboard insights]({{< relref "dashboard-datasource-insights.md" >}}), which contains more details about recent user activity.
When there are more active users on a dashboard than can fit within the presence indicator, click the **+X** icon. Doing so opens [dashboard insights]({{< relref "dashboard-datasource-insights.md" >}}), which contains more details about recent user activity.
{{< figure src="/static/img/docs/enterprise/presence_indicators.png" max-width="400px" class="docs-image--no-shadow" >}}