We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When running a NRQL query that uses both FACET and TIMESERIES, the library returns an error because it cannot encode the results into the structs.
FACET
TIMESERIES
go version go1.21.3 darwin/amd64
The following error is returned:
json: cannot unmarshal array into Go struct field NRDBResultContainer.data.Actor.Account.NRQL.otherResult of type nrdb.NRDBResult
The results are returned without error (as they are in the New Relic UI).
package main import ( "fmt" "os" "time" "github.com/newrelic/newrelic-client-go/v2/newrelic" "github.com/newrelic/newrelic-client-go/v2/pkg/nrdb" ) func threshold(client *newrelic.NewRelic) { accountID := 1234567 // This query fails: // query := "SELECT percentile(duration, 95) AS 'foobar' FROM Transaction FACET request.method TIMESERIES 1 hours SINCE '2024-01-17 14:51:00 +0000' UNTIL '2024-01-17 19:51:00 +0000'" // These queries work: // query := "SELECT percentile(duration, 95) AS 'foobar' FROM Transaction FACET request.method SINCE '2024-01-17 14:51:00 +0000' UNTIL '2024-01-17 19:51:00 +0000'" query := "SELECT percentile(duration, 95) AS 'foobar' FROM Transaction TIMESERIES 1 hours SINCE '2024-01-17 14:51:00 +0000' UNTIL '2024-01-17 19:51:00 +0000'" resultContainer, err := client.Nrdb.Query(accountID, nrdb.NRQL(query)) if err != nil { fmt.Printf("error: %v\n", err) } fmt.Printf("resultContainer: %#v\n", resultContainer) } func main() { key := os.Getenv("NR_API_KEY") client, err := newrelic.New( newrelic.ConfigPersonalAPIKey(key), newrelic.ConfigHTTPTimeout(time.Second*30), ) if err != nil { fmt.Println(err) return } threshold(client) }
Set NR_API_KEY env var. Then use comments to try each of the 3 queries. The first one (with FACET and TIMESERIES) does not work.
NR_API_KEY
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
When running a NRQL query that uses both
FACET
andTIMESERIES
, the library returns an error because it cannot encode the results into the structs.Go Version
go version go1.21.3 darwin/amd64
Current behavior
The following error is returned:
Expected behavior
The results are returned without error (as they are in the New Relic UI).
Steps To Reproduce
Set
NR_API_KEY
env var. Then use comments to try each of the 3 queries. The first one (with FACET and TIMESERIES) does not work.The text was updated successfully, but these errors were encountered: