Skip to content

Commit

Permalink
update latest metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Sep 24, 2024
1 parent 30584f6 commit 90e3a9c
Show file tree
Hide file tree
Showing 15 changed files with 4,445 additions and 4,489 deletions.
23 changes: 13 additions & 10 deletions connector/api/schema.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions connector/api/types.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c *PrometheusConnector) TryInitState(ctx context.Context, conf *metadata.C
if err != nil {
return nil, err
}
ndcSchema, errs := utils.MergeSchemas(promSchema, api.GetConnectorSchema())
ndcSchema, errs := utils.MergeSchemas(api.GetConnectorSchema(), promSchema)
for _, e := range errs {
slog.Debug(e.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion connector/internal/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func (qce *QueryCollectionExecutor) evalValueComparisonCondition(operator *schem
if !ok {
return "", fmt.Errorf("value: unsupported comparison operator `%s`", operator)
}
return fmt.Sprintf(" %s %s", op, value), nil
return fmt.Sprintf(" %s %f", op, *v), nil
}

func (qce *QueryCollectionExecutor) evalStringCondition(name string, operator string, value any) (string, bool, error) {
Expand Down
10 changes: 5 additions & 5 deletions connector/metadata/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ var defaultScalars = map[string]schema.ScalarType{
AggregateFunctions: schema.ScalarTypeAggregateFunctions{},
ComparisonOperators: map[string]schema.ComparisonOperatorDefinition{
Equal: schema.NewComparisonOperatorEqual().Encode(),
NotEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarString))).Encode(),
Least: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarString))).Encode(),
LeastOrEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarString))).Encode(),
Greater: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarString))).Encode(),
GreaterOrEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarString))).Encode(),
NotEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarDecimal))).Encode(),
Least: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarDecimal))).Encode(),
LeastOrEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarDecimal))).Encode(),
Greater: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarDecimal))).Encode(),
GreaterOrEqual: schema.NewComparisonOperatorCustom(schema.NewNamedType(string(ScalarDecimal))).Encode(),
},
Representation: schema.NewTypeRepresentationBigDecimal().Encode(),
},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.0
require (
github.com/alecthomas/kong v1.2.1
github.com/go-viper/mapstructure/v2 v2.2.0
github.com/hasura/ndc-sdk-go v1.3.1-0.20240922072552-9808dacbcee4
github.com/hasura/ndc-sdk-go v1.3.1-0.20240924031613-bf965d014b44
github.com/iancoleman/strcase v0.3.0
github.com/invopop/jsonschema v0.12.0
github.com/lmittmann/tint v1.0.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjw
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
github.com/hasura/ndc-sdk-go v1.3.1-0.20240922072552-9808dacbcee4 h1:iAHA7iUI6U24OlM2EZR+gk6lj1rxFyxwZnnXNmhtWbI=
github.com/hasura/ndc-sdk-go v1.3.1-0.20240922072552-9808dacbcee4/go.mod h1:HYlvIl0qvoUupwb0MfDY9JZnltab+qSDQapEeSC70jY=
github.com/hasura/ndc-sdk-go v1.3.1-0.20240924031613-bf965d014b44 h1:2sjWUqUlhiGsn4OaoAGKWyleq0ArWDBB33M6rEyWNpg=
github.com/hasura/ndc-sdk-go v1.3.1-0.20240924031613-bf965d014b44/go.mod h1:HYlvIl0qvoUupwb0MfDY9JZnltab+qSDQapEeSC70jY=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
Expand Down
166 changes: 166 additions & 0 deletions tests/engine/app/metadata/go_gc_cycles_automatic_gc_cycles_total.hml
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
---
kind: ObjectType
version: v1
definition:
name: ValueBoundaryInput
description: Boundary input arguments
fields:
- name: max
type: Float64!
description: The upper limit of values
- name: min
type: Float64!
description: The lower limit of values
graphql:
typeName: ValueBoundaryInput
inputTypeName: ValueBoundaryInput_input
dataConnectorTypeMapping:
- dataConnectorName: prometheus
dataConnectorObjectType: ValueBoundaryInput

---
kind: TypePermissions
version: v1
definition:
typeName: ValueBoundaryInput
permissions:
- role: admin
output:
allowedFields:
- max
- min

---
kind: ObjectType
version: v1
definition:
name: HoltWintersInput
description: Input arguments for the holt_winters function
fields:
- name: range
type: RangeResolution!
description: The range value
- name: sf
type: Float64!
description: The lower the smoothing factor sf, the more importance is given to
old data. Must be between 0 and 1
- name: tf
type: Float64!
description: The higher the trend factor tf, the more trends in the data is
considered. Must be between 0 and 1
graphql:
typeName: HoltWintersInput
inputTypeName: HoltWintersInput_input
dataConnectorTypeMapping:
- dataConnectorName: prometheus
dataConnectorObjectType: HoltWintersInput

---
kind: TypePermissions
version: v1
definition:
typeName: HoltWintersInput
permissions:
- role: admin
output:
allowedFields:
- range
- sf
- tf

---
kind: ObjectType
version: v1
Expand Down Expand Up @@ -74,6 +144,70 @@ definition:
- replacement
- source_label

---
kind: ObjectType
version: v1
definition:
name: PredictLinearInput
description: Input arguments for the predict_linear function
fields:
- name: range
type: RangeResolution!
description: The range value
- name: t
type: Float64!
description: Number of seconds from now
graphql:
typeName: PredictLinearInput
inputTypeName: PredictLinearInput_input
dataConnectorTypeMapping:
- dataConnectorName: prometheus
dataConnectorObjectType: PredictLinearInput

---
kind: TypePermissions
version: v1
definition:
typeName: PredictLinearInput
permissions:
- role: admin
output:
allowedFields:
- range
- t

---
kind: ObjectType
version: v1
definition:
name: QuantileOverTimeInput
description: Input arguments for the quantile_over_time function
fields:
- name: quantile
type: Float64!
description: The φ-quantile (0 ≤ φ ≤ 1) of the values
- name: range
type: RangeResolution!
description: The range value
graphql:
typeName: QuantileOverTimeInput
inputTypeName: QuantileOverTimeInput_input
dataConnectorTypeMapping:
- dataConnectorName: prometheus
dataConnectorObjectType: QuantileOverTimeInput

---
kind: TypePermissions
version: v1
definition:
typeName: QuantileOverTimeInput
permissions:
- role: admin
output:
allowedFields:
- quantile
- range

---
kind: ObjectType
version: v1
Expand Down Expand Up @@ -449,6 +583,38 @@ definition:
- timestamp
- topk

---
kind: ObjectType
version: v1
definition:
name: QueryResultValue
description: A value of the query result
fields:
- name: timestamp
type: Timestamp!
description: The timestamp when the value is calculated
- name: value
type: Decimal!
description: The metric value
graphql:
typeName: QueryResultValue
inputTypeName: QueryResultValue_input
dataConnectorTypeMapping:
- dataConnectorName: prometheus
dataConnectorObjectType: QueryResultValue

---
kind: TypePermissions
version: v1
definition:
typeName: QueryResultValue
permissions:
- role: admin
output:
allowedFields:
- timestamp
- value

---
kind: ObjectType
version: v1
Expand Down
Loading

0 comments on commit 90e3a9c

Please sign in to comment.