Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# actionlint configuration
# https://github.com/rhysd/actionlint/blob/main/docs/config.md
1 change: 0 additions & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
branches:
- name: main
protection:
Expand Down
10 changes: 2 additions & 8 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,15 @@ pull:
daysUntilClose: 14
daysUntilStale: 60
markComment: >
Hello 👋 Looks like there was no activity on this amazing PR for the last 60 days.
**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! 🤗

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!).
Hello 👋 Looks like there was no activity on this amazing PR for the last 60 days. **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! 🤗 #magic___^_^___line 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!).
# unmarkComment: No need for unmark comment.
closeComment: >
Closing for now as promised, let us know if you need this to be reopened! 🤗
issues:
daysUntilClose: 90
daysUntilStale: 180
markComment: >
Hello 👋 Looks like there was no activity on this issue for the last 3 months.
**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! 🤗

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!).
Hello 👋 Looks like there was no activity on this issue for the last 3 months. **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! 🤗 #magic___^_^___line 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!).
# unmarkComment: No need for unmark comment.
closeComment: >
Closing for now as promised, let us know if you need this to be reopened! 🤗
56 changes: 28 additions & 28 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '31 21 * * 6'

Expand All @@ -40,39 +40,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
language: ['go']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5
9 changes: 4 additions & 5 deletions .github/workflows/container_description.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: Push README to Docker Hub
on:
push:
paths:
- "README.md"
- "README-containers.md"
- ".github/workflows/container_description.yml"
branches: [ main, master ]
branches: [main, master]

permissions:
contents: read
Expand All @@ -22,7 +21,7 @@ jobs:
with:
persist-credentials: false
- name: Set docker hub repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> "$GITHUB_ENV"
- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
Expand All @@ -46,9 +45,9 @@ jobs:
with:
persist-credentials: false
- name: Set quay.io org name
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
run: echo "DOCKER_REPO=$(echo "quay.io/${GITHUB_REPOSITORY_OWNER}" | tr -d '-')" >> "$GITHUB_ENV"
- name: Set quay.io repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> "$GITHUB_ENV"
- name: Push README to quay.io
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint
on:
Expand All @@ -12,14 +11,14 @@ on:
- ".golangci.yml"
pull_request:

permissions: # added using https://github.com/step-security/secure-repo
permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
golangci:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
schedule:
- cron: '22 1 * * 0'
push:
branches: [ "main" ]
branches: ["main"]

# Declare default permissions as read only.
permissions: read-all
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/update-go-versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Generate Metric files for new Go version

on:
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Validate
on:
pull_request:
Expand All @@ -22,16 +21,16 @@ jobs:
name: Fetch supported Go versions
runs-on: ubuntu-latest
outputs:
supported_versions: ${{ steps.matrix.outputs.supported_versions }}
supported_versions: ${{ steps.matrix.outputs.supported_versions }}
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Read supported_go_versions.txt
id: matrix
run: |
versions=$(cat supported_go_versions.txt)
matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]"
echo "supported_versions=$matrix" >> $GITHUB_OUTPUT
versions=$(cat supported_go_versions.txt)
matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]"
echo "supported_versions=$matrix" >> "$GITHUB_OUTPUT"

test:
name: Tests (${{ matrix.go_version }})
Expand Down Expand Up @@ -69,3 +68,22 @@ jobs:
- name: Run style and unused
if: ${{ matrix.go_version == '1.22' }}
run: make style unused

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up Go
uses: actions/[email protected]
with:
go-version: stable
check-latest: true

- name: Lint YAML files
run: make lint-yaml

- name: Lint GitHub Actions workflows
run: make lint-actions
17 changes: 17 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yamlfmt configuration
# https://github.com/google/yamlfmt

doublestar: true

exclude:
- "**/testdata/**"
- "**/*testdata*/**"

gitignore_excludes: true

formatter:
type: basic
indent: 2
include_document_start: false
retain_line_breaks: true
max_line_length: 0
25 changes: 25 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
extends: default
ignore: |
**/node_modules

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
commas: disable
comments: disable
comments-indentation: disable
document-start: disable
indentation:
spaces: consistent
indent-sequences: consistent
key-duplicates:
ignore: |
config/testdata/section_key_dup.bad.yml
line-length: disable
truthy:
check-keys: false
32 changes: 31 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ BUF_VERSION ?= v1.39.0
$(BUF):
go install github.com/bufbuild/buf/cmd/buf@$(BUF_VERSION)

.DEFAULT_GOAL := default
default: precheck style check_license format lint unused test

.PHONY: deps
deps:
$(MAKE) common-deps
Expand All @@ -45,7 +48,10 @@ generate-go-collector-test-files:
go mod tidy

.PHONY: fmt
fmt: common-format
fmt: common-format format-yaml fix-crlf

.PHONY: format
format: fmt

.PHONY: proto
proto: ## Regenerate Go from remote write proto.
Expand All @@ -66,6 +72,30 @@ test-exp:
test-exp-short:
cd exp && $(GOTEST) -short $(GOOPTS) $(pkgs)

YAMLFMT := $(FIRST_GOPATH)/bin/yamlfmt
ACTIONLINT := $(FIRST_GOPATH)/bin/actionlint

$(YAMLFMT):
go install github.com/google/yamlfmt/cmd/yamlfmt@latest

$(ACTIONLINT):
go install github.com/rhysd/actionlint/cmd/actionlint@latest

.PHONY: format-yaml
format-yaml: $(YAMLFMT)
@echo ">> formatting YAML files"
$(YAMLFMT) -dstar '**/*.yml' '**/*.yaml'

.PHONY: lint
lint: common-lint common-yamllint common-lint-fix lint-actions

lint-yaml: common-yamllint

.PHONY: lint-actions
lint-actions: $(ACTIONLINT)
@echo ">> linting GitHub Actions workflows"
$(ACTIONLINT)

.PHONY: check-crlf
check-crlf:
@echo ">> checking for CRLF line endings"
Expand Down
2 changes: 1 addition & 1 deletion api/prometheus/v1/api_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func generateData(timeseries, datapoints int) (floatMatrix, histogramMatrix mode
floatMatrix = append(floatMatrix, fss)
histogramMatrix = append(histogramMatrix, hss)
}
return
return floatMatrix, histogramMatrix
}

func BenchmarkSamplesJsonSerialization(b *testing.B) {
Expand Down
28 changes: 14 additions & 14 deletions exp/api/remote/genproto/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
version: v2

plugins:
- remote: buf.build/protocolbuffers/go:v1.31.0
out: .
opt:
- Mio/prometheus/write/v2/types.proto=./v2
- remote: buf.build/protocolbuffers/go:v1.31.0
out: .
opt:
- Mio/prometheus/write/v2/types.proto=./v2

# vtproto for efficiency utilities like pooling etc.
# https://buf.build/community/planetscale-vtprotobuf?version=v0.6.0
- remote: buf.build/community/planetscale-vtprotobuf:v0.6.0
out: .
opt:
- Mio/prometheus/write/v2/types.proto=./v2
- features=marshal+unmarshal+size
# vtproto for efficiency utilities like pooling etc.
# https://buf.build/community/planetscale-vtprotobuf?version=v0.6.0
- remote: buf.build/community/planetscale-vtprotobuf:v0.6.0
out: .
opt:
- Mio/prometheus/write/v2/types.proto=./v2
- features=marshal+unmarshal+size

inputs:
- module: buf.build/prometheus/prometheus:5b212ab78fb7460e831cf7ff2d83e385
types:
- "io.prometheus.write.v2.Request"
- module: buf.build/prometheus/prometheus:5b212ab78fb7460e831cf7ff2d83e385
types:
- "io.prometheus.write.v2.Request"
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ loop:
s = skipSpace(s[1:])
}
}
return
return specs
}

func skipSpace(s string) (rest string) {
Expand Down
2 changes: 1 addition & 1 deletion prometheus/example_clustermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *ClusterManager) ReallyExpensiveAssessmentOfTheSystemState() (
"foo.example.org": 6.023e23,
"bar.example.org": 3.14,
}
return
return oomCountByHost, ramUsageByHost
}

// ClusterManagerCollector implements the Collector interface.
Expand Down
2 changes: 1 addition & 1 deletion prometheus/graphite/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func stringToLines(s string) (lines []string, err error) {
lines = append(lines, scanner.Text())
}
err = scanner.Err()
return
return lines, err
}

func TestPush(t *testing.T) {
Expand Down
Loading