Skip to content

Commit b237230

Browse files
committed
Merge branch 'main' into sparsehistogram
2 parents 294cca4 + 5d584e2 commit b237230

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2679
-472
lines changed

.circleci/config.yml

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22
orbs:
3-
go: circleci/go@0.2.0
4-
prometheus: prometheus/prometheus@0.15.0
3+
go: circleci/go@1.7.1
4+
prometheus: prometheus/prometheus@0.16.0
55
jobs:
66
test:
77
parameters:
@@ -17,8 +17,7 @@ jobs:
1717
type: boolean
1818
default: true
1919
docker:
20-
- image: circleci/golang:<< parameters.go_version >>
21-
working_directory: /go/src/github.com/prometheus/client_golang
20+
- image: cimg/go:<< parameters.go_version >>
2221
steps:
2322
- checkout
2423
- when:
@@ -47,18 +46,6 @@ workflows:
4746
client_golang:
4847
jobs:
4948
# Refer to README.md for the currently supported versions.
50-
- test:
51-
name: go-1-13
52-
go_version: "1.13"
53-
run_lint: true
54-
- test:
55-
name: go-1-14
56-
go_version: "1.14"
57-
run_lint: true
58-
- test:
59-
name: go-1-15
60-
go_version: "1.15"
61-
run_lint: true
6249
- test:
6350
name: go-1-16
6451
go_version: "1.16"
@@ -67,4 +54,10 @@ workflows:
6754
name: go-1-17
6855
go_version: "1.17"
6956
run_lint: true
57+
- test:
58+
name: go-1-18
59+
go_version: "1.18"
60+
run_lint: true
61+
# Style and unused/missing packages are only checked against
62+
# the latest supported Go version.
7063
run_style_and_unused: true

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/stale.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
# daysUntilStale: 30
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8+
# daysUntilClose: 7
9+
10+
# NOTICE: Check below for the individual settings for each type of event.
11+
12+
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
13+
onlyLabels: []
14+
15+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
16+
exemptLabels:
17+
- pinned
18+
- security
19+
- keep-open
20+
- wip
21+
- "[Status] Maybe Later"
22+
23+
# Set to true to ignore issues in a project (defaults to false)
24+
exemptProjects: true # default: false
25+
26+
# Set to true to ignore issues in a milestone (defaults to false)
27+
exemptMilestones: true # default: false
28+
29+
# Set to true to ignore issues with an assignee (defaults to false)
30+
exemptAssignees: false
31+
32+
# Label to use when marking as stale
33+
staleLabel: stale
34+
35+
# Comment to post when marking as stale. Set to `false` to disable
36+
# markComment: >
37+
# This issue has been automatically marked as stale because it has not had
38+
# recent activity. It will be closed if no further activity occurs. Thank you
39+
# for your contributions.
40+
41+
# Comment to post when removing the stale label.
42+
# unmarkComment: >
43+
# Your comment here.
44+
45+
# Comment to post when closing a stale Issue or Pull Request.
46+
# closeComment: >
47+
# Your comment here.
48+
49+
# Limit the number of actions per hour, from 1-30. Default is 30
50+
limitPerRun: 30
51+
52+
# Limit to only `issues` or `pulls`
53+
# only: issues
54+
55+
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
56+
# pulls:
57+
# daysUntilStale: 30
58+
# markComment: >
59+
# This pull request has been automatically marked as stale because it has not had
60+
# recent activity. It will be closed if no further activity occurs. Thank you
61+
# for your contributions.
62+
63+
# issues:
64+
# exemptLabels:
65+
# - confirmed
66+
67+
pull:
68+
daysUntilClose: 14
69+
daysUntilStale: 60
70+
markComment: >
71+
Hello 👋 Looks like there was no activity on this amazing PR for the last 60 days.
72+
**Do you mind updating us on the status?** Is there anything we can help with? If you plan to still work on it, just comment on this PR or push a commit. Thanks! 🤗
73+
74+
If there will be no activity in the next 2 weeks, this issue will be closed (we can always reopen a PR if you get back to this!).
75+
# unmarkComment: No need for unmark comment.
76+
closeComment: >
77+
Closing for now as promised, let us know if you need this to be reopened! 🤗
78+
issues:
79+
daysUntilClose: 90
80+
daysUntilStale: 180
81+
markComment: >
82+
Hello 👋 Looks like there was no activity on this issue for the last 3 months.
83+
**Do you mind updating us on the status?** Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
84+
85+
If there will be no activity in the next 4 weeks, this issue will be closed (we can always reopen an issue if we need!).
86+
# unmarkComment: No need for unmark comment.
87+
closeComment: >
88+
Closing for now as promised, let us know if you need this to be reopened! 🤗

.github/workflows/codeql-analysis.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '31 21 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/golangci-lint.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@ on:
99
- ".github/workflows/golangci-lint.yml"
1010
- ".golangci.yml"
1111
pull_request:
12-
paths:
13-
- "go.sum"
14-
- "go.mod"
15-
- "**.go"
16-
- "scripts/errcheck_excludes.txt"
17-
- ".github/workflows/golangci-lint.yml"
18-
- ".golangci.yml"
1912

2013
jobs:
2114
golangci:
2215
name: lint
2316
runs-on: ubuntu-latest
2417
steps:
2518
- name: Checkout repository
26-
uses: actions/checkout@v2
27-
19+
uses: actions/checkout@v3
20+
- name: install Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.18.x
24+
- name: Install snmp_exporter/generator dependencies
25+
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
26+
if: github.repository == 'prometheus/snmp_exporter'
2827
- name: Lint
29-
uses: golangci/golangci-lint-action@v2
28+
uses: golangci/golangci-lint-action@v3.1.0
3029
with:
31-
version: v1.42.0
30+
version: v1.45.2

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Examples
22
examples/simple/simple
33
examples/random/random
4+
examples/gocollector/gocollector
45

56
# Typical backup/temporary files of editors
67
*~
@@ -11,7 +12,7 @@ examples/random/random
1112
vendor/
1213

1314
# The remainder of this file is taken from
14-
# https://github.com/github/gitignore/blob/master/Go.gitignore
15+
# https://github.com/github/gitignore/blob/main/Go.gitignore
1516

1617
# Binaries for programs and plugins
1718
*.exe

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## Unreleased
2+
3+
* [CHANGE] Minimum required Go version is now 1.16.
4+
5+
## 1.12.2 / 2022-05-13
6+
7+
* [CHANGE] Added `collectors.WithGoCollections` that allows to choose what collection of Go runtime metrics user wants: Equivalent of [`MemStats` structure](https://pkg.go.dev/runtime#MemStats) configured using `GoRuntimeMemStatsCollection`, new based on dedicated [runtime/metrics](https://pkg.go.dev/runtime/metrics) metrics represented by `GoRuntimeMetricsCollection` option, or both by specifying `GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection` flag.
8+
* [CHANGE] :warning: Change in `collectors.NewGoCollector` metrics: Reverting addition of new ~80 runtime metrics by default. You can enable this back with `GoRuntimeMetricsCollection` option or `GoRuntimeMemStatsCollection | GoRuntimeMetricsCollection` for smooth transition.
9+
* [BUGFIX] Fixed the bug that causes generated histogram metric names to end with `_total`. ⚠️ This changes 3 metric names in the new Go collector that was reverted from default in this release.
10+
* `go_gc_heap_allocs_by_size_bytes_total` -> `go_gc_heap_allocs_by_size_bytes`,
11+
* `go_gc_heap_frees_by_size_bytes_total` -> `go_gc_heap_allocs_by_size_bytes`
12+
* `go_gc_pauses_seconds_total` -> `go_gc_pauses_seconds`.
13+
* [CHANCE] Removed `-Inf` buckets from new Go Collector histograms.
14+
115
## 1.12.1 / 2022-01-29
216

317
* [BUGFIX] Make the Go 1.17 collector concurrency-safe #969

CODE_OF_CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## Prometheus Community Code of Conduct
1+
# Prometheus Community Code of Conduct
22

3-
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
3+
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).

Dockerfile

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# This Dockerfile builds an image for a client_golang example.
22
#
33
# Use as (from the root for the client_golang repository):
4-
# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
4+
# docker build -f Dockerfile -t prometheus/golang-example .
5+
6+
# Run as
7+
# docker run -P prometheus/golang-example /random
8+
# or
9+
# docker run -P prometheus/golang-example /simple
10+
11+
# Test as
12+
# curl $ip:$port/metrics
513

614
# Builder image, where we build the example.
715
FROM golang:1 AS builder
@@ -13,11 +21,14 @@ WORKDIR /go/src/github.com/prometheus/client_golang/examples/random
1321
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
1422
WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple
1523
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
24+
WORKDIR /go/src/github.com/prometheus/client_golang/examples/gocollector
25+
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'
1626

1727
# Final image.
1828
FROM quay.io/prometheus/busybox:latest
1929
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
2030
COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \
21-
/go/src/github.com/prometheus/client_golang/examples/simple ./
31+
/go/src/github.com/prometheus/client_golang/examples/simple \
32+
/go/src/github.com/prometheus/client_golang/examples/gocollector ./
2233
EXPOSE 8080
23-
CMD ["echo", "Please run an example. Either /random or /simple"]
34+
CMD ["echo", "Please run an example. Either /random, /simple or /gocollector"]

Makefile.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
8383

8484
GOLANGCI_LINT :=
8585
GOLANGCI_LINT_OPTS ?=
86-
GOLANGCI_LINT_VERSION ?= v1.42.0
86+
GOLANGCI_LINT_VERSION ?= v1.45.2
8787
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8888
# windows isn't included here because of the path separator being different.
8989
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Prometheus Go client library
22

3-
[![CircleCI](https://circleci.com/gh/prometheus/client_golang/tree/master.svg?style=svg)](https://circleci.com/gh/prometheus/client_golang/tree/master)
3+
[![CircleCI](https://circleci.com/gh/prometheus/client_golang/tree/main.svg?style=svg)](https://circleci.com/gh/prometheus/client_golang/tree/main)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang)
55
[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang.svg)](https://pkg.go.dev/github.com/prometheus/client_golang)
6+
[![Slack](https://img.shields.io/badge/join%20slack-%23prometheus--client_golang-brightgreen.svg)](https://slack.cncf.io/)
67

78
This is the [Go](http://golang.org) client library for
89
[Prometheus](http://prometheus.io). It has two separate parts, one for
910
instrumenting application code, and one for creating clients that talk to the
1011
Prometheus HTTP API.
1112

12-
__This library requires Go1.13 or later.__
13+
__This library requires Go1.16 or later.__
1314

1415
## Important note about releases and stability
1516

@@ -34,21 +35,21 @@ coexist for a while to enable a convenient transition.
3435
[![code-coverage](http://gocover.io/_badge/github.com/prometheus/client_golang/prometheus)](http://gocover.io/github.com/prometheus/client_golang/prometheus) [![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang/prometheus.svg)](https://pkg.go.dev/github.com/prometheus/client_golang/prometheus)
3536

3637
The
37-
[`prometheus` directory](https://github.com/prometheus/client_golang/tree/master/prometheus)
38+
[`prometheus` directory](https://github.com/prometheus/client_golang/tree/main/prometheus)
3839
contains the instrumentation library. See the
3940
[guide](https://prometheus.io/docs/guides/go-application/) on the Prometheus
4041
website to learn more about instrumenting applications.
4142

4243
The
43-
[`examples` directory](https://github.com/prometheus/client_golang/tree/master/examples)
44+
[`examples` directory](https://github.com/prometheus/client_golang/tree/main/examples)
4445
contains simple examples of instrumented code.
4546

4647
## Client for the Prometheus HTTP API
4748

4849
[![code-coverage](http://gocover.io/_badge/github.com/prometheus/client_golang/api/prometheus/v1)](http://gocover.io/github.com/prometheus/client_golang/api/prometheus/v1) [![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang/api.svg)](https://pkg.go.dev/github.com/prometheus/client_golang/api)
4950

5051
The
51-
[`api/prometheus` directory](https://github.com/prometheus/client_golang/tree/master/api/prometheus)
52+
[`api/prometheus` directory](https://github.com/prometheus/client_golang/tree/main/api/prometheus)
5253
contains the client for the
5354
[Prometheus HTTP API](http://prometheus.io/docs/querying/api/). It allows you
5455
to write Go applications that query time series data from a Prometheus
@@ -57,12 +58,14 @@ server. It is still in alpha stage.
5758
## Where is `model`, `extraction`, and `text`?
5859

5960
The `model` packages has been moved to
60-
[`prometheus/common/model`](https://github.com/prometheus/common/tree/master/model).
61+
[`prometheus/common/model`](https://github.com/prometheus/common/tree/main/model).
6162

6263
The `extraction` and `text` packages are now contained in
63-
[`prometheus/common/expfmt`](https://github.com/prometheus/common/tree/master/expfmt).
64+
[`prometheus/common/expfmt`](https://github.com/prometheus/common/tree/main/expfmt).
6465

6566
## Contributing and community
6667

6768
See the [contributing guidelines](CONTRIBUTING.md) and the
6869
[Community section](http://prometheus.io/community/) of the homepage.
70+
71+
`clint_golang` community is also present on the CNCF Slack `#prometheus-client_golang`.

0 commit comments

Comments
 (0)