Skip to content
New issue

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

Bind Exporter 0.6.0 not compatible with Bind version 9.18.12+ #162

Closed
bschoenbach opened this issue Mar 16, 2023 · 12 comments
Closed

Bind Exporter 0.6.0 not compatible with Bind version 9.18.12+ #162

bschoenbach opened this issue Mar 16, 2023 · 12 comments

Comments

@bschoenbach
Copy link
Contributor

bschoenbach commented Mar 16, 2023

Hi guys,

I noticed that starting with bind version 9.18.12+ the exporter is not capable to parse the XML output of the bind statistics channel (:8053) anymore. The exporter logs the following lines....

level=info ts=2023-03-16T13:08:31.750Z caller=bind_exporter.go:541 msg="Starting bind_exporter" version="(version=0.6.0, branch=HEAD, revision=7464905c46d60755105b3b6c25ff88e161fcae2c)" level=info ts=2023-03-16T13:08:31.750Z caller=bind_exporter.go:542 msg="Build context" build_context="(go=go1.19.3, user=root@cb284bc56c1d, date=20221110-19:23:25)" level=info ts=2023-03-16T13:08:31.750Z caller=bind_exporter.go:543 msg="Collectors enabled" collectors=server,view,tasks level=info ts=2023-03-16T13:08:31.750Z caller=tls_config.go:232 msg="Listening on" address=[::]:9119 level=info ts=2023-03-16T13:08:31.750Z caller=tls_config.go:235 msg="TLS is disabled." http2=false address=[::]:9119 level=error ts=2023-03-16T13:08:41.865Z caller=bind_exporter.go:441 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \"-1\": invalid syntax" level=error ts=2023-03-16T13:08:42.062Z caller=bind_exporter.go:441 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \"-1\": invalid syntax" level=error ts=2023-03-16T13:08:42.071Z caller=bind_exporter.go:441 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \"-1\": invalid syntax" level=error ts=2023-03-16T13:08:52.065Z caller=bind_exporter.go:441 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \"-1\": invalid syntax" level=error ts=2023-03-16T13:08:52.069Z caller=bind_exporter.go:441 msg="Couldn't retrieve BIND stats" err="failed to unmarshal XML response: strconv.ParseUint: parsing \"-1\": invalid syntax"

However, accessing the bind statistics channel manually via curl on :8053 works perfect and i can get the following xml response as you can see below attached.

stats_output.xml.txt

The only thing i noticed is that the amount of xml data is bigger on the statistic channel starting from bind 9.18.12+. Using bind 9.18.11 or older the exporter works picture perfect again

@bschoenbach bschoenbach changed the title Bind Exporter 0.6.0 not compatible to Bind version 9.18.12+ Bind Exporter 0.6.0 not compatible with Bind version 9.18.12+ Mar 16, 2023
@bschoenbach
Copy link
Contributor Author

also tried exporter version 0.4.0 and 0.5.0......the same behaviour....none works with bind 9.18.12+

@cybermcm
Copy link

Can confirm, same here. I use bind 9.19 and also not working anymore

@paketb0te
Copy link

There are negative values in the stats_output.xml file provided by @bschoenbach :

    <taskmgr>
        ...
        <tasks>
            ...
            <task>
                <name>taskpool</name>
                <references>1</references>
                <id>0x7fe65d766440</id>
                <state>idle</state>
                <quantum>-1</quantum>    <--
                <events>0</events>
            </task>
            ...
        </tasks>

The corresponding Quantum field in the Task struct is an uint64, which would explain the parsing problem very well (since we actually receive a signed integer, -1):

// Task represents a single running task.
type Task struct {
	ID         string `xml:"id"`
	Name       string `xml:"name"`
	Quantum    uint64 `xml:"quantum"`    <--
	References uint64 `xml:"references"`
	State      string `xml:"state"`
}

I am not sure how to handle that though 🤔

@SuperQ
Copy link
Contributor

SuperQ commented Mar 22, 2023

Should be easy enough to change this to an int64. It'd be nice if there was a code reference to prove the unit, but it's a simple enough change.

@bschoenbach
Copy link
Contributor Author

After testing i can confirm changing Quantum type from uint64 -> int64 fixes the problem...I will raise a pull request to master

@bschoenbach
Copy link
Contributor Author

@SuperQ @cybermcm @paketb0te @
#166

@paketb0te
Copy link

paketb0te commented Mar 22, 2023

Should be easy enough to change this to an int64. It'd be nice if there was a code reference to prove the unit, but it's a simple enough change.

@SuperQ the change itself looks trivial, I was just not sure how I'd go about checking / verifying that we can actually use an int64 (e.g. if that metric were a counter, how do we handle negative values?) 🤔

@SuperQ
Copy link
Contributor

SuperQ commented Mar 22, 2023

@paketb0te Looking at the metrics/code. This value isn't used anywhere. It's just used to unmarshal the XML.

@SuperQ SuperQ closed this as completed Mar 22, 2023
@dswarbrick
Copy link
Member

@paketb0te Looking at the metrics/code. This value isn't used anywhere. It's just used to unmarshal the XML.

If we don't use that value anywhere, why do we even bother unmarshalling that field?

@SuperQ
Copy link
Contributor

SuperQ commented Mar 24, 2023

Probably because of the way Go does XML parsing. :-/

@dswarbrick
Copy link
Member

@SuperQ I don't see why there should be any issue with only declaring fields / tags that we are interested in. See https://go.dev/play/p/XoXKTcjOTQL for example.

From a quick glance at the code, I suspect that bind_exporter is unmarshalling a whole bunch of stuff that it doesn't actually translate into metrics.

@SuperQ
Copy link
Contributor

SuperQ commented Mar 30, 2023

Yea, I don't know the history of the XML parsing.

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

No branches or pull requests

5 participants