prometheus / prometheus/exporter-toolkit

Non-JSON log line "remote error: tls: unknown certificate"

Open
#254 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
311
Forks
109
Avg merge
3d 59m
Merged PRs (30d)
6

Description

The following are the logs I'm seeing from the prometheus exporter I've built. The last line happens when I launch the landing page/url in my browser. The cert is self-signed so I expect it to maybe warn, but I certainly don't expect it to be non-JSON as I'm passing my logger in and it uses JSON.

	if err := web.ListenAndServe(&http.Server{}, &web.FlagConfig{
		WebListenAddresses: &[]string{server.webListenAddress},
		WebConfigFile:      &server.configFile,
	}, log.Logger); err != nil {
		log.Error(fmt.Sprintf("Error starting web server: %s", err.Error()))
		os.Exit(1)
	}
❯ go run -ldflags="-X main.version=$(cat VERSION) -X main.commit=$(git rev-parse HEAD)" main.go --controller-address http://anka.controller:8090 -web.config.file web.config.yml
{"time":"2024-09-17T20:42:55.378809-05:00","level":"INFO","msg":"Starting Prometheus Exporter for Anka (3.0.1)"}
{"time":"2024-09-17T20:42:55.443433-05:00","level":"INFO","msg":"Serving metrics at :2112/metrics"}
{"time":"2024-09-17T20:42:55.443825-05:00","level":"INFO","msg":"Listening on","address":"[::]:2112"}
{"time":"2024-09-17T20:42:55.444787-05:00","level":"INFO","msg":"TLS is enabled.","http2":true,"address":"[::]:2112"}
2024/09/17 20:43:53 http: TLS handshake error from 127.0.0.1:54574: remote error: tls: unknown certificate

I'm having trouble finding where this comes from though. It seems to be generated from something not using the logger I passed in.

Any recommendations?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the web.ListenAndServe call and the supplied log.Logger integration, then reproduce the self-signed-certificate request shown in the report. Trace where the TLS handshake error is emitted and determine whether it can use the configured logger. Done means the handshake error is emitted in the expected JSON format without changing the reported server behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, prometheus
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.