Skip to content

Commit

Permalink
fix: do not set line protocol encoder precision
Browse files Browse the repository at this point in the history
  • Loading branch information
cailloumajor committed Jul 6, 2022
1 parent d9e4323 commit 0f3b05d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration_tests/cypress/integration/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("InfluxDB metrics endpoint", () => {
expect(parsed[2]).to.include('2263="open62541"')
expect(parsed[2]).to.include("the.answer=42")
expect(parsed[2]).to.include('myByteString="test123"')
const ts = new Date(parseInt(parsed[3], 10) * 1000)
const ts = new Date(parseInt(parsed[3], 10) / 1e6)
const now = Date.now()
expect(ts).to.satisfy((d) => !isNaN(d), "date is not NaN")
expect(now - ts).to.be.below(10000)
Expand Down
1 change: 0 additions & 1 deletion internal/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func (p *Proxy) handleInfluxdbMetrics(w http.ResponseWriter, r *http.Request) {
r.Form.Del(measurementKey)

var enc lp.Encoder
enc.SetPrecision(lp.Second)
enc.StartLine(m)

sk := make([]string, 0, len(r.Form))
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestInfluxdbMetrics(t *testing.T) {
variantConvertError: false,
encodingError: false,
expectStatusCode: http.StatusOK,
expectBody: `meas,othertag=otherval,tag1=val1 field1=37.2,field2="value" 1136239445` + "\n",
expectBody: `meas,othertag=otherval,tag1=val1 field1=37.2,field2="value" 1136239445000000000` + "\n",
ignoreBody: false,
},
}
Expand Down

0 comments on commit 0f3b05d

Please sign in to comment.