Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

chore: remove simplejson dep #18

Merged
merged 2 commits into from
Sep 19, 2019
Merged

chore: remove simplejson dep #18

merged 2 commits into from
Sep 19, 2019

Conversation

kylebrandt
Copy link
Contributor

removes grafana/grafana dependency.

query: rn.Query,
timeRange: tr,
intervalMS: 1000,
maxDP: 5000,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intervalMS and maxDP could be constants?

if !ok {
return nil, fmt.Errorf("expected datasourceId to be a float64, got %T for refId %v", rawDsID, rn.RefID)
}
dsNode.datasourceID = int64(floatDsID)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why datasourceId should be float64 in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the json is decoded into map[string]interface{} all the numbers become floats. Could use https://golang.org/pkg/encoding/json/#Decoder.UseNumber to make it a json.Number but I don't think it really matters in these cases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

if !ok {
return nil, fmt.Errorf("expected orgId to be a float64, got %T for refId %v", rawOrgID, rn.RefID)
}
dsNode.orgID = int64(floatOrgID)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why orgId should be float64 in the first place?

if floatMaxDP, ok = rawMaxDP.(float64); !ok {
return nil, fmt.Errorf("expected maxDataPoints to be an float64, got %T for refId %v", rawMaxDP, rn.RefID)
}
dsNode.maxDP = int64(floatMaxDP)
Copy link

@papagian papagian Sep 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why intervalMs and maxDataPoints should be float64 in the first place?

Copy link

@papagian papagian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! That was a good introduction to the GEL code.
I have some questions.

@kylebrandt kylebrandt merged commit 764153d into master Sep 19, 2019
@kylebrandt kylebrandt deleted the noSimlpleJSON branch September 19, 2019 10:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants