Skip to content

Commit

Permalink
tql-query => query-string (#210)
Browse files Browse the repository at this point in the history
* query-string

* version

* no changes

* ok
  • Loading branch information
MisterSquishy authored Feb 12, 2024
1 parent 3ee2eaa commit 8853075
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name ${{ github.actor }}
git add .
git commit -m "added terraform docs"
git push
if [[ `git status --porcelain` ]]; then
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name ${{ github.actor }}
git add .
git commit -m "added terraform docs"
git push
else
echo "no changes"
fi
terraform_lint:

Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.91.0
1.91.1

2 changes: 1 addition & 1 deletion client/metric_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type MetricQueryWithAttributes struct {
Query MetricQuery `json:"metric-query"`
SpansQuery SpansQuery `json:"spans-query,omitempty"`
CompositeQuery CompositeQuery `json:"composite-query,omitempty"`
TQLQuery string `json:"tql-query"`
QueryString string `json:"query-string"`
DependencyMapOptions *DependencyMapOptions `json:"dependency-map-options,omitempty"`
HiddenQueries map[string]bool `json:"hidden-queries,omitempty"`
}
Expand Down
8 changes: 4 additions & 4 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ resource "lightstep_metric_dashboard" "exported_dashboard" {
group_by_keys = [{{range .SpansQuery.GroupByKeys}}"{{.}}",{{end}}]{{if eq .SpansQuery.Operator "latency"}}
latency_percentiles = [{{range .SpansQuery.LatencyPercentiles}}{{.}},{{end}}]{{end}}
}
{{end}}{{if .TQLQuery}}
tql = {{escapeHeredocString .TQLQuery}}
{{end}}{{if .QueryString}}
tql = {{escapeHeredocString .QueryString}}
{{end}}{{if .Query.Metric}}
metric = "{{.Query.Metric}}"
timeseries_operator = "{{.Query.TimeseriesOperator}}"
Expand Down Expand Up @@ -75,7 +75,7 @@ resource "lightstep_dashboard" "exported_dashboard" {
query_name = "{{.Name}}"
display = "{{.Display}}"
hidden = {{.Hidden}}
query_string = {{escapeHeredocString .TQLQuery}}
query_string = {{escapeHeredocString .QueryString}}
{{- if .DependencyMapOptions}}
dependency_map_options {
scope = "{{.DependencyMapOptions.Scope}}"
Expand Down Expand Up @@ -124,7 +124,7 @@ func dashboardUsesLegacyQuery(d *client.UnifiedDashboard) bool {
// Assume if a chart is defined but has query string defined, it uses a legacy query. This
// isn't strictly correct if the chart has *no* query but a chart with no query is not
// meaningful to begin with.
if len(q.TQLQuery) == 0 {
if len(q.QueryString) == 0 {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ EOT`,
Name: "my_query",
Display: "line",
Hidden: false,
TQLQuery: testCase.QueryString,
QueryString: testCase.QueryString,
DependencyMapOptions: testCase.DependencyMapOptions,
},
},
Expand Down
4 changes: 2 additions & 2 deletions lightstep/legacy_query_equivalence.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func compareUpdatedLegacyQueries(
if len(priorQueries) == len(updatedQueries) &&
hasOnlyTQLQueries(priorQueries) && hasOnlyTQLQueries(updatedQueries) {
for i, pq := range priorQueries {
if pq.TQLQuery != updatedQueries[i].TQLQuery {
if pq.QueryString != updatedQueries[i].QueryString {
return false, nil
}
}
Expand Down Expand Up @@ -165,7 +165,7 @@ func compareUpdatedLegacyQueries(
if q.Type != "tql" {
return false, nil
}
updatedUQL[simplifyQueryName(q.Name)] = q.TQLQuery
updatedUQL[simplifyQueryName(q.Name)] = q.QueryString
}

// Step 3: compare the queries are equivalent
Expand Down
2 changes: 1 addition & 1 deletion lightstep/resource_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func getQueriesFromUnifiedConditionResourceData(
"hidden": q.Hidden,
"display": q.Display,
"query_name": q.Name,
"query_string": q.TQLQuery,
"query_string": q.QueryString,
}
queries = append(queries, qs)
}
Expand Down
2 changes: 1 addition & 1 deletion lightstep/resource_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func getQueriesFromUnifiedDashboardResourceData(
"display": q.Display,
"display_type_options": convertNestedMapToSchemaSet(q.DisplayTypeOptions),
"query_name": q.Name,
"query_string": q.TQLQuery,
"query_string": q.QueryString,
"dependency_map_options": getDependencyMapOptions(q.DependencyMapOptions),
}
if len(q.HiddenQueries) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions lightstep/resource_metric_condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ func buildQueries(queriesIn []interface{}) ([]client.MetricQueryWithAttributes,
Type: "tql",
Hidden: query["hidden"].(bool),
Display: query["display"].(string),
TQLQuery: queryString,
QueryString: queryString,
DependencyMapOptions: buildDependencyMapOptions(query["dependency_map_options"]),
}

Expand Down Expand Up @@ -1427,7 +1427,7 @@ func getQueriesFromMetricConditionData(queriesIn []client.MetricQueryWithAttribu
"exclude_filters": excludeFilters,
"filters": allFilters,
"group_by": groupBy,
"tql": q.TQLQuery, // deprecated
"tql": q.QueryString,
}
if q.Query.TimeseriesOperatorInputWindowMs != nil {
qs["timeseries_operator_input_window_ms"] = *q.Query.TimeseriesOperatorInputWindowMs
Expand Down

0 comments on commit 8853075

Please sign in to comment.