Skip to content

Commit

Permalink
generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcarmody committed Dec 19, 2023
1 parent 934c0ce commit 1e764fa
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 71 deletions.
73 changes: 2 additions & 71 deletions docs/resources/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Provides a [Lightstep alert](https://api-docs.lightstep.com/reference/listalerts

Visit [Lightstep's documentation](https://docs.lightstep.com/docs/about-alerts) for conceptual information about alerts and alert templates.

## Example Usage (single alert)
## Example Usage

```hcl
resource "lightstep_alert" "beemo-requests" {
project_name = var.project
name = "Frontend latency"
expression {
is_multi = false
is_multi = true
is_no_data = true
operand = "above"
thresholds {
Expand All @@ -46,75 +46,6 @@ EOT
}
```

## Example Usage (composite alert)

```hcl
resource "lightstep_alert" "high_error_rate_with_sustained_traffic" {
project_name = var.project
name = "Error rates are high for my operation with sustained traffic"
description = <<EOF
Fires when over 20% of requests are erroring, but only when requests are above 75 spans over an hour window. This prevents firing when we have very low traffic and get a few error requests.
EOF
label {
key = "team"
value = "my_team"
}
composite_alert {
alert {
name = "A"
title = "Span Error %"
expression {
operand = "above"
thresholds {
critical = 20
}
}
query {
hidden = false
query_name = "a"
query_string = "with\n\terrors = spans count | delta 1h | filter my_tag == my_value && error == true | group_by [], sum;\n\ttotal = spans count | delta 1h | filter my_tag == my_value | group_by [], sum;\njoin 100*errors / total, errors=0, total=0"
display = "line"
hidden_queries = {
"a" = false
}
}
}
alert {
name = "B"
title = "Span Count"
query {
hidden = false
query_name = "a"
query_string = "spans count | delta 1h | filter my_tag == my_value | group_by [], sum"
display = "line"
hidden_queries = {
"a" = false
}
}
expression {
operand = "above"
thresholds {
critical = 75
}
}
}
}
alerting_rule {
id = lightstep_pagerduty_destination.my_destination.id
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
79 changes: 79 additions & 0 deletions docs/resources/metric_condition.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,85 @@ description: |-
Provides a Lightstep Metric Condition. Use this resource to create and manage Lightstep Metric Conditions that can contain either
metric queries or span queries.

## Example Usage (metric query)

```hcl
resource "lightstep_metric_condition" "beemo-requests" {
project_name = var.project
name = "Beemo Low Requests"
label {
key = "team"
value = "ontology"
}
label {
value = "custom-label"
}
expression {
is_multi = true
is_no_data = true
operand = "below"
thresholds {
warning = 10.0
critical = 5.0
}
}
metric_query {
metric = "requests"
query_name = "a"
timeseries_operator = "delta"
timeseries_operator_input_window_ms = 30000
hidden = false
display = "line"
include_filters = [
{
key = "kube_instance"
value = "3"
}
]
group_by {
aggregation_method = "max"
keys = ["key1", "key2"]
}
}
```

## Example Usage (span query)

```hcl
resource "lightstep_metric_condition" "beemo-requests" {
project_name = var.project
name = "Frontend latency"
expression {
is_multi = true
is_no_data = true
operand = "above"
thresholds {
warning = 5.0
critical = 10.0
}
}
metric_query {
query_name = "a"
hidden = false
display = "line"
spans {
query = "service IN (\"frontend\")"
operator = "latency"
operator_input_window_ms = 3600000
latency_percentiles = [50]
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

Expand Down

0 comments on commit 1e764fa

Please sign in to comment.