Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Wrong types inferred in query specification #553

Open
purkhusid opened this issue Oct 4, 2024 · 1 comment
Open

Wrong types inferred in query specification #553

purkhusid opened this issue Oct 4, 2024 · 1 comment
Labels

Comments

@purkhusid
Copy link

Versions
0.27.1

Steps to reproduce

If you have the following query specification:

data "honeycombio_query_specification" "board-istio-data-plane-system-4xx-errors" {
  calculation {
    op     = "RATE_SUM"
    column = "istio_requests_total"
  }

  filter {
    column = "istio_requests_total"
    op     = "exists"
  }

  filter {
    column = "k8s.namespace.name"
    op     = "="
    value  = "istio-system"
  }

  filter {
    column = "response_code"
    op     = "starts-with"
    value  = "4"
  }

  breakdowns = ["k8s.pod.name"]
  time_range = 3600
}

The filter value for response_code is inferred to be an integer when the spec is passed to e.g. a honeycomb query resource. The filter should infer the value to be a string.

The query json ends up as:

"{\"calculations\":[{\"op\":\"RATE_SUM\",\"column\":\"istio_requests_total\"}],\"filters\":[{\"column\":\"istio_requests_total\",\"op\":\"exists\"},{\"column\":\"k8s.namespace.name\",\"op\":\"=\",\"value\":\"istio-system\"},{\"column\":\"response_code\",\"op\":\"starts-with\",\"value\":4}],\"breakdowns\":[\"k8s.pod.name\"],\"time_range\":3600}"

but should end up as:

"{\"calculations\":[{\"op\":\"RATE_SUM\",\"column\":\"istio_requests_total\"}],\"filters\":[{\"column\":\"istio_requests_total\",\"op\":\"exists\"},{\"column\":\"k8s.namespace.name\",\"op\":\"=\",\"value\":\"istio-system\"},{\"column\":\"response_code\",\"op\":\"starts-with\",\"value\":\"4'"}],\"breakdowns\":[\"k8s.pod.name\"],\"time_range\":3600}"
@jharley jharley added the bug label Oct 7, 2024
@jharley
Copy link
Collaborator

jharley commented Oct 7, 2024

@purkhusid thanks for reporting this!

I'm afraid the solution -- as I understand it -- is not so trivial at the moment but I have half-started the work to move to Dynamic Attributes instead of the type coercion/inference we're currently doing.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants