Skip to content

Commit

Permalink
Merge pull request #33 from intergral/docs
Browse files Browse the repository at this point in the history
chore(docs): add links to be docs
  • Loading branch information
Umaaz authored Feb 15, 2024
2 parents 570ac56 + eb9c520 commit 15a632b
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# main (unreleased)

- **[FEATURE]**: Add support for metrics and traces [#34](https://github.com/intergral/deep/pull/34) [@Umaaz](https://github.com/Umaaz)
- **[ENHANCEMENT]**: Improve the firecount input to make it easier to understand [#34](https://github.com/intergral/deep/pull/34) [@Umaaz](https://github.com/Umaaz)
- **[ENHANCEMENT]**: Improve the fire count input to make it easier to understand [#34](https://github.com/intergral/deep/pull/34) [@Umaaz](https://github.com/Umaaz)
- **[BUGFIX]**: Correct links for documentation on query builder [#33](https://github.com/intergral/deep/pull/33) [@Umaaz](https://github.com/Umaaz)

<!-- main END -->

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ services:
volumes:
- ./:/root/dev
- ./dist:/var/lib/grafana/plugins/intergral-deep-datasource
- ~/repo/github/intergral/grafana-deep-panel/dist:/var/lib/grafana/plugins/intergral-deep-panel
- ~/repo/github/intergral/grafana-deep-tracepoint-panel/dist:/var/lib/grafana/plugins/grafana-deep-tracepoint-panel
- ./provisioning:/etc/grafana/provisioning
35 changes: 35 additions & 0 deletions docs/docs/explore/create_tracepoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Create Tracepoint

To create a tracepoint using Explore first select the 'Deep' data source then ensure you select 'Tracepoints -> Create
Tracepoint' as below

![Create Tracepoint](create_tracepoint.png)

Now you will need to configure the tracepoint to trigger the way you need it to. To do this you **MUST** set the file
and line number (all other settings are optional).

| Config | Default | Example | Description |
| ----------- | ------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| File Path | | simple_test.py | This is the file path to for the **source** file in which the trigger is to be installed. This can be a full path or just the file name, the usage of this is dependant on the agent that is being used. |
| Line number | | 42 | This is the line number in the **source** file where the trigger is to be installed. |
| Fire Count | 1 | 10 | This is the number of times the trigger should fire before it is disabled. This count is per client not a global value. This can be set to 'Forever' to trigger the tracepoint every time (rate limiting still applies) until it is removed. |
| Targeting | | service.name=myapp | This is a query that is used to target triggers to specific clients based on the client resource. Using the targeting `service.name=myapp` will mean only clients that define the label `service.name` with the value `myapp` will receive this trigger. |
| Log Message | | user id = {user.id} | This allows for dynamic log messages to be injected into the target application. These log messages will be output by the client and can be consumed by log platforms such as Loki. The log messages can contain expressions between `{}` that will be evaluated at the trigger location, allowing for the extraction of local variables. |
| Trace | None | Line | This allows for dynamic spans to be injected, by selecting 'Line' a span will be created around the targeted line. Selecting 'Method/Function', will create a span around the enclosing method/function. |
| Metrics | | basket_size len(basket.items) | This allows for dynamic metrics to be created using the local variables. [Read more below.](#metrics) |
| Watches | | user.id | This allows for selection of specific variables when using snapshots. To learn more about watches view the docs for the [client](https://intergral.github.io/deep/#client) being used. |

# Metrics

When creating metrics you can specify the metric name, and the value.

- The name should be a compatible metric lowercase and with underscores(\_).
- The metric name will be prefixed with 'deep\_' to ensure we do not affect existing metrics. Meaning if the metric
name given is 'basket_size' then the metric generated will be 'deep_basket_size'.
- The value can be:
- A value: a fixed numeric value
- An expression: an expression that used local variables to extract a numeric value.

When defining metrics it is important that the expression used is valid and results in a numeric value. Any errors while
processing the metrics will result in no metrics being produced, and nothing appearing in the metric endpoint. Any
errors can be seen in the client logs, if enabled.
Binary file added docs/docs/explore/create_tracepoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/docs/explore/delete_tracepoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Delete Tracepoint

To delete a tracepoint using Explore, select the Deep datasource and select 'Tracepoints -> Delete Tracepoint'.

![Delete Tracepoint](delete_tracepoint.png)

In this section you can enter the ID of the tracepoint to delete. The ID of the tracepoint is visible in the table view
of the list tracepoint response (this should also provide a delete link). If using the 'intergral-deep-tracepoint-panel'
plugin then a button is available to delete the tracepoint.
Binary file added docs/docs/explore/delete_tracepoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/docs/explore/find_by_id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Find ID

The simplest way to view the connected snapshots is to use 'Find ID' this requires you to provide the ID of the
snapshot to view. You can do this using the Explore page 'Find ID', while selecting a Deep datasource.

![Find ID](find_id.png)
Binary file added docs/docs/explore/find_id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/docs/explore/list_tracepoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# List Tracepoint

To list the configured tracepoints using Explore, select the Deep datasource and select 'Tracepoints -> List Tracepoints'.

![List Tracepoints](list_tracepoint.png)

Using the run query button will list the available tracepoints.
Binary file added docs/docs/explore/list_tracepoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions docs/docs/explore/search_snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Search

Search can be used to search for snapshots that have been triggered. Using explore open the Deep datasource and select search.

![Search Snapshot](search_snapshot.png)

Here you can enter a query to narrow down the search.

- Service Name: This lets you select a service by name that has sent snapshots
- Tags: Here you can further filter by any attribute or resource value

The results will be shown as a table where you can select a single snapshot to view.
Binary file added docs/docs/explore/search_snapshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion src/components/FindByIDSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ export function FindByIDSearch({ datasource, query, onChange, onRunQuery }: Prop
return (
<>
<div className={styles.container}>
<InlineLabel>Enter the ID of a snapshot to view the data.</InlineLabel>
<InlineLabel>
Enter the ID of a snapshot to view the data.
<a
rel="noreferrer"
target="_blank"
href="https://intergral.github.io/grafana-deep-datasource/explore/find_by_id/"
>
Documentation
</a>
</InlineLabel>
<InlineFieldRow>
<InlineField label="Find by ID" invalid={inputErrors.byid} grow tooltip="Find a single snapshot by ID">
<Input
Expand Down
17 changes: 14 additions & 3 deletions src/components/NativeSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';

import { GrafanaTheme2, SelectableValue, toOption } from '@grafana/data';
import { FetchError, getTemplateSrv, isFetchError } from '@grafana/runtime';
import { Alert, fuzzyMatch, InlineField, InlineFieldRow, Input, Select, useStyles2 } from '@grafana/ui';
import { Alert, fuzzyMatch, InlineField, InlineFieldRow, InlineLabel, Input, Select, useStyles2 } from '@grafana/ui';

import { TagsField } from './TagsField/TagsField';
import { Props } from './QueryEditor';
Expand Down Expand Up @@ -101,6 +101,16 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
return (
<>
<div className={styles.container}>
<InlineLabel className={styles.label}>
Search for snapshots.
<a
rel="noreferrer"
target="_blank"
href="https://intergral.github.io/grafana-deep-datasource/explore/search_snapshot/"
>
Documentation
</a>
</InlineLabel>
<InlineFieldRow>
<InlineField label="Service Name" labelWidth={14} grow>
<Select
Expand Down Expand Up @@ -180,8 +190,9 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
export default NativeSearch;

const getStyles = (theme: GrafanaTheme2) => ({
container: css`
max-width: 500px;
container: css``,
label: css`
width: inherit;
`,
alert: css`
max-width: 75ch;
Expand Down
6 changes: 5 additions & 1 deletion src/components/tracepoints/TracepointDelete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export const TracepointDelete = ({ datasource, query, onChange, onRunQuery }: Pr
<>
<InlineLabel>
Enter a tracepoint id to delete the tracepoint
<a rel="noreferrer" target="_blank" href="TODO/">
<a
rel="noreferrer"
target="_blank"
href="https://intergral.github.io/grafana-deep-datasource/explore/delete_tracepoint/"
>
Documentation
</a>
</InlineLabel>
Expand Down
6 changes: 5 additions & 1 deletion src/components/tracepoints/TracepointList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const TracepointList = ({ query, onChange, onRunQuery }: Props) => {
<>
<InlineLabel>
Show the current configured tracepoints
<a rel="noreferrer" target="_blank" href="TODO/">
<a
rel="noreferrer"
target="_blank"
href="https://intergral.github.io/grafana-deep-datasource/explore/list_tracepoint/"
>
Documentation
</a>
</InlineLabel>
Expand Down

0 comments on commit 15a632b

Please sign in to comment.