prometheus / prometheus/exporter-toolkit

omitempty for all struct fields

Open
#222 0 comments 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

All fields , (e.g. in Config, TLSConfig) should have yaml:"<NAME>,omitempty"

https://github.com/prometheus/exporter-toolkit/blob/master/web/tls_config.go#L39

For example, it doesn't make sense that TLSConfig.MinVersion appears as 0 when marshaled to YAML. Prometheus crashes if you try to use this web config via --web.config.file=:

caller=main.go:949 level=error msg="Unable to validate web configuration file" err="unknown TLS version: 0"

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 in web/tls_config.go at the linked TLSConfig definition, then inspect the Config and related struct fields mentioned in the issue. Reproduce the YAML marshaling or web.config.file validation case and verify that omitted zero-value fields no longer appear as 0 or cause an unknown TLS version error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.