Generates a Query Specificaiton in JSON format.
This is a data source which can be used to construct a JSON representation of a Honeycomb Query Specification. The json
attribute contains a serialized JSON representation which can be passed to the query_json
field of the honeycombio_query
resource for use in boards and triggers.
data "honeycombio_query_specification" "example" {
# zero or more calculation blocks
calculation {
op = "AVG"
column = "duration_ms"
}
# zero or more filter blocks
filter {
column = "trace.parent_id"
op = "does-not-exist"
}
filter {
column = "app.tenant"
op = "="
value = "ThatSpecialTenant"
}
filter_combination = "AND"
breakdowns = ["app.tenant"]
time_range = 28800 // in seconds, 8 hours
}
output "json_query" {
value = data.honeycombio_query_specification.example.json
}
The following arguments are supported:
calculation
- (Optional) Zero or more configuration blocks (described below) with the calculations that should be displayed. If no calculations are specified, COUNT
will be used.filter
- (Optional) Zero or more configuration blocks (described below) with the filters that should be applied.filter_combination
- (Optional) How to combine multiple filters, either AND
(default) or OR
.breakdowns
- (Optional) A list of fields to group by.order
- (Optional) Zero or more configuration blocks (described below) describing how to order the query results. Each term must appear in either calculation
or breakdowns
.having
- (Optional) Zero or more filters used to restrict returned groups in the query result.limit
- (Optional) The maximum number of query results, must be between 1 and 1000.time_range
- (Optional) The time range of the query in seconds, defaults to 7200
(two hours).start_time
- (Optional) The absolute start time of the query in Unix Time (= seconds since epoch).end_time
- (Optional) The absolute end time of the query in Unix Time (= seconds since epoch).granularity
- (Optional) The time resolution of the query’s graph, in seconds. Valid values must be in between the query’s time range /10 at maximum, and /1000 at minimum.Each query configuration may have zero or more calculation
blocks, which each accept the following arguments:
op
- (Required) The operator to apply, see the supported list of calculation operators at Calculation Operators.column
- (Optional) The column to apply the operator to, not needed with COUNT
or CONCURRENCY
.Each query configuration may have zero or more filter
blocks, which each accept the following arguments:
column
- (Required) The column to apply the filter to.op
- (Required) The operator to apply, see the supported list of filter operators at Filter Operators. Not all operators require a value.value
- (Optional) The value used for the filter. Not needed if op is exists
or not-exists
. Mutually exclusive with the other value_*
options.value_string
- (Optional) Deprecated: use 'value' instead. The value used for the filter when the column is a string. Mutually exclusive with value
and the other value_*
options.value_integer
- (Optional) Deprecated: use 'value' instead. The value used for the filter when the column is an integer. Mutually exclusive with value
and the other value_*
options.value_float
- (Optional) Deprecated: use 'value' instead. The value used for the filter when the column is a float. Mutually exclusive with value
and the other value_*
options.value_boolean
- (Optional) Deprecated: use 'value' instead. The value used for the filter when the column is a boolean. Mutually exclusive with value
and the other value_*
options.
-> NOTE Filter op in
and not-in
expect an array of strings as value. Use the value
attribute and pass the values in single string separated by ,
without additional spaces (similar to the query builder in the UI). For example: the list foo
, bar
becomes foo,bar
.
Each query configuration may have zero or more order
blocks, which each accept the following arguments. An order term can refer to a calculation
or a column set in breakdowns
. When referring to a calculation
, op
and column
must be the same as the calculation.
op
- (Optional) The calculation operator to apply, see the supported list of calculation operators at Calculation Operators.column
- (Optional) Either a column present in breakdown
or a column to op
applies to.order
- (Optional) The sort direction, if set must be ascending
or descending
.Each query configuration may have zero or more having
blocks, which each accept the following arguments.
op
- The operator to apply to filter the query results. One of =
, !=
, >
, >=
, <
, or <=
.calculate_op
- The calculation operator to apply, supports all of the Calculation Operators with the exception of HEATMAP
.column
- The column to apply the calculate_op
to, not needed with COUNT
or CONCURRENCY
.value
- The value used with op
. Currently assumed to be a number.In addition to all arguments above, the following attributes are exported:
id
- ID of the query specification.json
- JSON representation of the query according to the Query Specification, can be used as input for other resources.