Skip to content
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

Fix unrendered "example" section #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ output "alert" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
16 changes: 5 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ description: |-

# signoz Provider



## Example Usage

```terraform
Expand All @@ -19,16 +17,12 @@ provider "signoz" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Optional

- `access_token` (String, Sensitive) Access token of the SigNoz API. You can retrieve it from SigNoz UI
with Admin Role ([documentation](https://signoz.io/newsroom/launch-week-1-day-5/#using-access-token)).
Also, you can set it using environment variable SIGNOZ_ACCESS_TOKEN.
- `endpoint` (String) Endpoint of the SigNoz. It is the root URL of the SigNoz UI.
Also, you can set it using environment variable SIGNOZ_ENDPOINT. If not set, it defaults to http://localhost:3301.
- `http_max_retry` (Number) Specifies the max retry limit for the HTTP requests made to SigNoz.
Also, you can set it using environment variable SIGNOZ_HTTP_MAX_RETRY. If not set, it defaults to 10.
- `http_timeout` (Number) Specifies the timeout limit in seconds for the HTTP requests made to SigNoz.
Also, you can set it using environment variable SIGNOZ_HTTP_TIMEOUT. If not set, it defaults to 35.
- `access_token` (String, Sensitive) Access token of the SigNoz API. You can retrieve it from SigNoz UI with Admin Role ([documentation](https://signoz.io/newsroom/launch-week-1-day-5/#using-access-token)). Also, you can set it using environment variable SIGNOZ_ACCESS_TOKEN.
- `endpoint` (String) Endpoint of the SigNoz. It is the root URL of the SigNoz UI. Also, you can set it using environment variable SIGNOZ_ENDPOINT. If not set, it defaults to http://localhost:3301.
- `http_max_retry` (Number) Specifies the max retry limit for the HTTP requests made to SigNoz. Also, you can set it using environment variable SIGNOZ_HTTP_MAX_RETRY. If not set, it defaults to 10.
- `http_timeout` (Number) Specifies the timeout limit in seconds for the HTTP requests made to SigNoz. Also, you can set it using environment variable SIGNOZ_HTTP_TIMEOUT. If not set, it defaults to 35.
1 change: 1 addition & 0 deletions docs/resources/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ output "alert_new" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand Down
20 changes: 20 additions & 0 deletions examples/data-sources/alert/example_1.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
signoz = {
source = "registry.terraform.io/signoz/signoz"
}
}
}

provider "signoz" {
endpoint = "http://localhost:3301"
# access_token = "ACCESS_TOKEN"
}

data "signoz_alert" "get_alert" {
id = "5"
}

output "alert" {
value = data.signoz_alert.get_alert
}
3 changes: 3 additions & 0 deletions examples/example_1.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider "signoz" {
# example configuration here
}
99 changes: 99 additions & 0 deletions examples/resources/alert/example_1.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
terraform {
required_providers {
signoz = {
source = "registry.terraform.io/signoz/signoz"
}
}
}

provider "signoz" {
endpoint = "http://localhost:3301"
# access_token = "ACCESS_TOKEN"
}

resource "signoz_alert" "new_alert" {
alert = "TF Test Alert"
alert_type = "METRIC_BASED_ALERT"
broadcast_to_all = false
condition = jsonencode(
{
absentFor = 10
alertOnAbsent = true
compositeQuery = {
builderQueries = {
A = {
ShiftBy = 0
aggregateAttribute = {
dataType = "float64"
isColumn = true
isJSON = false
key = "k8s_node_memory_rss"
type = "Gauge"
}
aggregateOperator = "avg"
dataSource = "metrics"
disabled = false
expression = "A"
filters = {
items = []
op = "AND"
}
groupBy = [
{
dataType = "string"
isColumn = false
isJSON = false
key = "k8s_node_name"
type = "tag"
},
]
limit = 0
offset = 0
pageSize = 0
queryName = "A"
reduceTo = "avg"
spaceAggregation = "avg"
stepInterval = 60
timeAggregation = "avg"
}
}
chQueries = {
A = {
disabled = false
query = ""
}
}
panelType = "graph"
promQueries = {
A = {
disabled = false
query = ""
}
}
queryType = "builder"
unit = "bytes"
}
matchType = "1"
op = "1"
selectedQueryName = "A"
target = 10
targetUnit = "gbytes"
}
)
description = "Alert is fired when the defined metric (current value: {{$value}}) crosses the threshold ({{$threshold}})"
eval_window = "5m0s"
frequency = "1m0s"
labels = {
"observer" = "local-test"
}
preferred_channels = [
"alert-test-terraform"
]
rule_type = "threshold_rule"
severity = "info"
version = "v4"
}

output "alert_new" {
value = signoz_alert.new_alert
}
46 changes: 46 additions & 0 deletions templates/data-sources/alert.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "signoz_alert Data Source - signoz"
subcategory: ""
description: |-
Fetches an alert from Signoz using its ID. The ID can be found in the URL of the alert in the Signoz UI.
---

{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates.

For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}}

# signoz_alert (Data Source)

Fetches an alert from Signoz using its ID. The ID can be found in the URL of the alert in the Signoz UI.

## Example Usage

{{tffile "examples/data-sources/alert/example_1.tf"}}

<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `id` (String) ID of the alert.

### Read-Only

- `alert` (String) Name of the alert.
- `alert_type` (String) Type of the alert. Possible values are: METRIC_BASED_ALERT, LOGS_BASED_ALERT, TRACES_BASED_ALERT, and EXCEPTIONS_BASED_ALERT.
- `broadcast_to_all` (Boolean) Whether to broadcast the alert to all the alert channels.
- `condition` (String) Condition of the alert.
- `description` (String) Description of the alert.
- `disabled` (Boolean) Whether the alert is disabled.
- `eval_window` (String) Evaluation window of the alert.
- `frequency` (String) Frequency of the alert.
- `labels` (Map of String) Labels of the alert. Severity is a required label.
- `preferred_channels` (List of String) List of preferred channels of the alert. This is a noop if BroadcastToAll is true.
- `rule_type` (String) Type of the Alert Rule for threshold. Possible values are: threshold_rule and promql_rule.
- `severity` (String) Severity of the alert.
- `source` (String) Source URL of the alert.
- `state` (String) State of the alert. Possible values are: inactive, firing, pending, and disabled.
- `summary` (String) Summary of the alert.
- `version` (String) Version of the alert.
28 changes: 28 additions & 0 deletions templates/index.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "signoz Provider"
subcategory: ""
description: |-

---

{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates.

For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}}

# signoz Provider

## Example Usage

{{tffile "examples/example_1.tf"}}

<!-- schema generated by tfplugindocs -->

## Schema

### Optional

- `access_token` (String, Sensitive) Access token of the SigNoz API. You can retrieve it from SigNoz UI with Admin Role ([documentation](https://signoz.io/newsroom/launch-week-1-day-5/#using-access-token)). Also, you can set it using environment variable SIGNOZ_ACCESS_TOKEN.
- `endpoint` (String) Endpoint of the SigNoz. It is the root URL of the SigNoz UI. Also, you can set it using environment variable SIGNOZ_ENDPOINT. If not set, it defaults to http://localhost:3301.
- `http_max_retry` (Number) Specifies the max retry limit for the HTTP requests made to SigNoz. Also, you can set it using environment variable SIGNOZ_HTTP_MAX_RETRY. If not set, it defaults to 10.
- `http_timeout` (Number) Specifies the timeout limit in seconds for the HTTP requests made to SigNoz. Also, you can set it using environment variable SIGNOZ_HTTP_TIMEOUT. If not set, it defaults to 35.
53 changes: 53 additions & 0 deletions templates/resources/alert.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "signoz_alert Resource - signoz"
subcategory: ""
description: |-
Creates and manages alert resources in SigNoz.
---

{{/* This template serves as a starting point for documentation generation, and can be customized with hardcoded values and/or doc gen templates.

For example, the {{ .SchemaMarkdown }} template can be used to replace manual schema documentation if descriptions of schema attributes are added in the provider source code. */ -}}

# signoz_alert (Resource)

Creates and manages alert resources in SigNoz.

## Example Usage

{{tffile "examples/resources/alert/example_1.tf"}}

<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `alert` (String) Name of the alert.
- `alert_type` (String) Type of the alert. Possible values are: METRIC_BASED_ALERT, LOGS_BASED_ALERT, TRACES_BASED_ALERT, and EXCEPTIONS_BASED_ALERT.
- `condition` (String) Condition of the alert.
- `severity` (String) Severity of the alert. Possible values are: info, warning, error, and critical.

### Optional

- `broadcast_to_all` (Boolean) Whether to broadcast the alert to all the alerting channels. By default, the alert is only sent to the preferred channels.
- `description` (String) Description of the alert.
- `disabled` (Boolean) Whether the alert is disabled.
- `eval_window` (String) The evaluation window of the alert. By default, it is 5m0s.
- `frequency` (String) The frequency of the alert. By default, it is 1m0s.
- `labels` (Map of String) Labels of the alert. Severity is a required label.
- `preferred_channels` (List of String) Preferred channels of the alert. By default, it is empty.
- `rule_type` (String) Type of the alert. Possible values are: threshold_rule and promql_rule.
- `source` (String) Source of the alert. By default, it is <SIGNOZ_ENDPOINT>/alerts.
- `summary` (String) Summary of the alert.
- `version` (String) Version of the alert. By default, it is v4.

### Read-Only

- `create_at` (String) Creation time of the alert.
- `create_by` (String) Creator of the alert.
- `id` (String) Autogenerated unique ID for the alert.
- `state` (String) State of the alert.
- `update_at` (String) Last update time of the alert.
- `update_by` (String) Last updater of the alert.