Open e-vrvr opened 6 years ago
Could you give an example of you config with auth
where you see this?
Sure
metrics:
frequency: 1m
reporters:
- type: influxdb
protocol: https
host: influxdb.example.com
port: 443
database: test
auth: user:password
tags:
host: dev
prefix: mymetrics_
precision: 10s
frequency: 10s
groupGauges: yes
includes:
- memory.heap.usage
UPD. latest version of library, dropwizard 1.2.0
I have the same issue.
I am using the influxdb docker without any configuration.
I basically call the reporter like this :
new InfluxDbHttpSender(influxUrl.getProtocol(),
influxUrl.getHost(),
influxUrl.getPort(),
db, influxUrl.getUserInfo(), TimeUnit.SECONDS,
1000, 1000, "")
and influxUrl is http://root:root@influx:8086/dbname
then I get the error :
api-service_1 | 13:47:37.650 [metrics-influxDb-reporter-1-thread-1] WARN com.izettle.metrics.influxdb.InfluxDbReporter - Unable to report to InfluxDB with error 'Illegal character(s) in message header value: Basic cm9vdDpyb290
api-service_1 | 13:48:37.643 [metrics-influxDb-reporter-1-thread-1] WARN com.izettle.metrics.influxdb.InfluxDbReporter - Unable to report to InfluxDB with error 'Illegal character(s) in message header value: Basic cm9vdDpyb290
I'm using the 1.2.2 version.
I think I have the fix, I try a PR soon. Found from stackoverflow
what I did was extending InfluxDbHttpSender
with this code
if (authString != null && !authString.isEmpty()) {
this.authStringEncoded = Base64.encodeBase64String(authString.getBytes(Charsets.UTF_8)).trim(); // this is the one single difference from parent class
} else {
this.authStringEncoded = "";
}
How can you extend as the properties are private final?
I found the reason of this bug : I was using another dependency that requires commons-condecs at version 1.4, and this version... adds a \n\r
.
Once I forced in my own pom the common-codecs to be 1.9 or later (we are at 1.11 today) no problem occures.
@rickard-von-essen-iz To ensure my fix, I have a unittest, do you want me to make a PR for that?
I'm trying to add authorization to my http(s) reporter, so I set config entry to
auth: user:password
. Later, here it gets encrypted todXNlcjpwYXNzd29yZA==\r\n
-note the newline symbols in the end. And then during connection construction, it fails withIllegal character(s) in message header field
here .Full stack trace:
Sample config
Is there any way to make this working?