Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
3a22599
add third relay in p2p-relays (#3227)
aly-obol Aug 14, 2024
b3f19eb
build(deps): Bump github.com/attestantio/go-eth2-client from 0.21.9 t…
dependabot[bot] Aug 16, 2024
ed1c95b
testutil/promrated: fixing promrated network overview stats (#3234)
Aug 19, 2024
b3cd3ee
docs: launchpad link is broken (#3231)
zekchan Sep 2, 2024
85d1dac
build(deps): Bump golang.org/x/sync from 0.7.0 to 0.8.0 (#3217)
dependabot[bot] Sep 3, 2024
096e646
build(deps): Bump github.com/docker/docker from 27.1.0+incompatible t…
dependabot[bot] Sep 3, 2024
ee1c8fb
build(deps): Bump golang.org/x/time from 0.5.0 to 0.6.0 (#3216)
dependabot[bot] Sep 3, 2024
5453475
build(deps): Bump golang.org/x/crypto from 0.25.0 to 0.26.0 (#3219)
dependabot[bot] Sep 3, 2024
fff444d
*: bump linter to v1.60.3 (#3247)
KaloyanTanev Sep 4, 2024
c929e8a
build(deps): Bump sigp/lighthouse from v5.2.1 to v5.3.0 in /testutil/…
dependabot[bot] Sep 4, 2024
8a60188
build(deps): Bump chainsafe/lodestar from v1.20.2 to v1.21.0 in /test…
dependabot[bot] Sep 4, 2024
369e2d7
cmd: refactor exits (#3248)
KaloyanTanev Sep 4, 2024
faba6c3
build(deps): Bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.3…
dependabot[bot] Sep 9, 2024
f63dd70
build(deps): Bump github.com/showwin/speedtest-go from 1.7.8 to 1.7.9…
dependabot[bot] Sep 9, 2024
4f89490
*: bump golang to 1.23.1 (#3261)
KaloyanTanev Sep 9, 2024
0e003d2
build(deps): Bump github.com/herumi/bls-eth-go-binary from 1.35.0 to …
dependabot[bot] Sep 9, 2024
92bdfda
cmd: hardening threshold parameter checks (#3242)
aadomn Sep 9, 2024
f14538f
build(deps): Bump github.com/prometheus/client_golang from 1.19.1 to …
dependabot[bot] Sep 9, 2024
2389721
workflows: bump govulncheck to v1.1.3 (#3262)
KaloyanTanev Sep 9, 2024
0140d1c
build(deps): Bump golang.org/x/crypto from 0.26.0 to 0.27.0 (#3265)
dependabot[bot] Sep 10, 2024
1cf2c5e
build(deps): Bump go.opentelemetry.io/otel/trace from 1.28.0 to 1.29.…
dependabot[bot] Sep 10, 2024
d673b48
build(deps): Bump go.opentelemetry.io/otel/exporters/stdout/stdouttra…
dependabot[bot] Sep 10, 2024
dc4a431
build(deps): Bump github.com/ferranbt/fastssz from 0.1.3 to 0.1.4 (#3…
dependabot[bot] Sep 10, 2024
18ffecb
build(deps): Bump golang.org/x/tools from 0.23.0 to 0.25.0 (#3270)
dependabot[bot] Sep 11, 2024
8150bff
build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/htt…
dependabot[bot] Sep 11, 2024
93bdc47
build(deps): Bump go.opentelemetry.io/otel from 1.29.0 to 1.30.0 (#3274)
dependabot[bot] Sep 11, 2024
c64f135
build(deps): Bump go.opentelemetry.io/otel/exporters/stdout/stdouttra…
dependabot[bot] Sep 11, 2024
7e4660c
*: add --all for exit sign command (#3272)
KaloyanTanev Sep 12, 2024
4f76adc
docs: fix typos (#3236)
cratiu222 Sep 17, 2024
4b856b7
build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/htt…
dependabot[bot] Sep 18, 2024
c882583
build(deps): Bump github.com/prometheus/client_golang from 1.20.3 to …
dependabot[bot] Sep 18, 2024
744f9b6
*: disable intrange linter (#3282)
gsora Sep 18, 2024
4f34883
cmd: broadcast all exits (#3288)
KaloyanTanev Sep 19, 2024
4042608
cmd: fetch all exits (#3291)
KaloyanTanev Sep 19, 2024
053a8c5
build(deps): Bump chainsafe/lodestar from v1.21.0 to v1.22.0 in /test…
dependabot[bot] Sep 19, 2024
e828f16
build(deps): Bump attestant/vouch from 1.8.2 to 1.9.0 in /testutil/co…
dependabot[bot] Sep 24, 2024
159d6f2
dkg: fixed TestSyncFlow (#3309)
pinebit Oct 1, 2024
72549c6
cmd: move threshold check to CLI level (#3297)
KaloyanTanev Oct 1, 2024
224b7ba
cmd: enable exit all (#3296)
KaloyanTanev Oct 1, 2024
6972d4c
build(deps): Bump go.uber.org/automaxprocs from 1.5.3 to 1.6.0 (#3300)
dependabot[bot] Oct 1, 2024
24a2afd
test: fix test performance flaky test (#3316)
KaloyanTanev Oct 3, 2024
f4bcdd5
*: create automate pr for release (#3310)
apham0001 Oct 3, 2024
e9fdf8e
build(deps): Bump golang from 1.23.1-alpine to 1.23.2-alpine in /test…
dependabot[bot] Oct 4, 2024
c9464a5
testutil: fixed smoke test (#3332)
pinebit Oct 10, 2024
4696c21
build(deps): Bump golang.org/x/tools from 0.25.0 to 0.26.0 (#3333)
dependabot[bot] Oct 11, 2024
555fa12
build(deps): Bump golang.org/x/time from 0.6.0 to 0.7.0 (#3322)
dependabot[bot] Oct 11, 2024
90ea27a
build(deps): Bump golang from 1.23.1-bookworm to 1.23.2-bookworm (#3314)
dependabot[bot] Oct 11, 2024
323d0e7
build(deps): Bump go.opentelemetry.io/otel from 1.30.0 to 1.31.0 (#3339)
dependabot[bot] Oct 15, 2024
95770d5
build(deps): Bump go.opentelemetry.io/otel/exporters/stdout/stdouttra…
dependabot[bot] Oct 15, 2024
bc87cf9
build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/htt…
dependabot[bot] Oct 15, 2024
c0072b6
*: optimize Dockerfile (#3281)
No0key Oct 15, 2024
c9bdd62
github: use minor go versions in pipelines (#3321)
KaloyanTanev Oct 15, 2024
38d7a6a
exit: add custom testnet flags for exits (#3317)
KaloyanTanev Oct 15, 2024
9ff33f3
build(deps): Bump github.com/prometheus/client_golang from 1.20.4 to …
dependabot[bot] Oct 16, 2024
48acae8
*: bump golangci-lint to v1.61.0 (#3348)
KaloyanTanev Oct 23, 2024
c4c3557
*: improve logging and error handling for exits (#3347)
KaloyanTanev Oct 28, 2024
fa29651
build(deps): Bump github.com/multiformats/go-multiaddr from 0.13.0 to…
dependabot[bot] Nov 4, 2024
c70a5be
cmd: increase Obol API timeout for exits (#3353)
KaloyanTanev Nov 4, 2024
69efcbb
*: add needs to trigger (#3351)
apham0001 Nov 4, 2024
2815409
github: bump only patch versions for bls library (#3352)
KaloyanTanev Nov 7, 2024
603e263
build(deps): Bump golang from 1.23.2-bookworm to 1.23.3-bookworm (#3359)
dependabot[bot] Nov 8, 2024
ccd8a7f
build(deps): Bump golang from 1.23.2-alpine to 1.23.3-alpine in /test…
dependabot[bot] Nov 8, 2024
3943a41
build(deps): Bump golang.org/x/sync from 0.8.0 to 0.9.0 (#3362)
dependabot[bot] Nov 8, 2024
569bb82
build(deps): Bump golang.org/x/time from 0.7.0 to 0.8.0 (#3363)
dependabot[bot] Nov 8, 2024
3402ff7
docs: fix typos in documentation files (#3364)
cypherpepe Nov 8, 2024
f56de9a
build(deps): Bump golang.org/x/crypto from 0.28.0 to 0.29.0 (#3366)
dependabot[bot] Nov 9, 2024
dbfaf1a
docs: fix typos and improve clarity in documentation files (#3367)
futreall Nov 11, 2024
1e0d4ce
cmd: add cluster lock and cluster definition to test peers (#3368)
KaloyanTanev Nov 11, 2024
22f6cf6
cmd: beacon node simulation (#3361)
KaloyanTanev Nov 11, 2024
993f806
build(deps): Bump go.opentelemetry.io/otel/trace from 1.31.0 to 1.32.…
dependabot[bot] Nov 12, 2024
1928e1d
build(deps): Bump golang.org/x/tools from 0.26.0 to 0.27.0 (#3373)
dependabot[bot] Nov 12, 2024
74f1fa2
build(deps): Bump go.opentelemetry.io/otel/sdk from 1.31.0 to 1.32.0 …
dependabot[bot] Nov 12, 2024
e412b57
build(deps): Bump chainsafe/lodestar from v1.22.0 to v1.23.0 in /test…
dependabot[bot] Nov 12, 2024
765ec3e
docs: typo in README.md (#3369)
mdqst Nov 12, 2024
88ebdbd
build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/htt…
dependabot[bot] Nov 12, 2024
683918a
cmd: test command UX (#3370)
KaloyanTanev Nov 12, 2024
1ce1211
build(deps): Bump go.opentelemetry.io/otel/exporters/stdout/stdouttra…
dependabot[bot] Nov 12, 2024
2bbd977
cmd: charon test mev create block tests (#3378)
KaloyanTanev Nov 14, 2024
4049c4a
cmd: add version check to beacon node tests (#3379)
KaloyanTanev Nov 14, 2024
b3452eb
cmd: rename test performance to test infra command (#3380)
KaloyanTanev Nov 14, 2024
b2b9d2b
*: fix trigger dispatch repo (#3381)
apham0001 Nov 14, 2024
fac5b69
build(deps): Bump google.golang.org/protobuf from 1.34.2 to 1.35.2 (#…
dependabot[bot] Nov 15, 2024
529d4cf
cmd: test command file output improvements (#3384)
KaloyanTanev Nov 15, 2024
94f7f50
cmd: add custom number of validators beacon simulation test (#3385)
KaloyanTanev Nov 18, 2024
b28d6c4
*: bump go to 1.23 (#3250)
KaloyanTanev Sep 4, 2024
956ccf3
core/consensus: logging leader index (#3334)
pinebit Oct 16, 2024
7e47fe8
*: removing mutable config (#3307)
KaloyanTanev Nov 19, 2024
c8a0c64
*: bumped protoc-gen-go (#3331)
pinebit Oct 10, 2024
044adbd
Bump version
KaloyanTanev Nov 20, 2024
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: 1 addition & 1 deletion .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ runs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.22.5'
go-version: '1.23'
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ updates:
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "github.com/herumi/bls-eth-go-binary"
update-types: ["version-update:semver-major","version-update:semver-minor"]
- package-ecosystem: "docker"
directories:
- "/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-push-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ jobs:
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CHARON_K8S_REPO_ACCESS_TOKEN }}
repository: ObolNetwork/charon-k8s
repository: ObolNetwork/obol-infrastructure
event-type: charon-package-published
client-payload: '{"sha": "${{ github.sha }}"}'
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- cron: '18 19 * * 6'

env:
GOLANG_VERSION: '1.22'
GOLANG_VERSION: '1.23'

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
version: v1.61.0
- name: notify failure
if: failure() && github.ref == 'refs/heads/main'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-go
- run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.0
- run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.3
- run: govulncheck -show=traces -test ./...
64 changes: 52 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,55 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Disable shallow checkout
- uses: ./.github/actions/setup-go
- run: go run . --help > cli-reference.txt
- run: go run testutil/genchangelog/main.go
- uses: softprops/action-gh-release@v1
with:
draft: true
files: cli-reference.txt
body_path: changelog.md
token: ${{ secrets.RELEASE_SECRET }}
- name: Checkout repository
uses: actions /checkout@v4
with:
fetch-depth: 0 # Disable shallow checkout

- name: Setup Go environment
uses: ./.github/actions/setup-go

- name: Generate CLI reference
run: go run . --help > cli-reference.txt

- name: Generate changelog
run: go run testutil/genchangelog/main.go

- name: Create GitHub release draft
uses: softprops/action-gh-release@v1
with:
draft: true
files: cli-reference.txt
body_path: changelog.md
token: ${{ secrets.RELEASE_SECRET }}

trigger-dispatch:
needs: release
runs-on: ubuntu-latest
steps:
- name: Extract tag name
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV

- name: Trigger dispatch for obol-docs
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/obol-docs
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'

- name: Trigger dispatch for helm-charts
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/helm-charts
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'

- name: Trigger dispatch for obol-ansible
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/obol-ansible
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'
22 changes: 10 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 5m
go: "1.22.5"
go: "1.23"
linters-settings:
cyclop:
max-complexity: 15
Expand Down Expand Up @@ -116,6 +116,12 @@ linters-settings:
- expected-actual
go-require:
ignore-http-handlers: true
gosec:
excludes:
# Flags for potentially-unsafe casting of ints, seems good,
# but currently is really unstable with no clear way to make the linter pass.
# https://github.com/securego/gosec/issues/1187
- G115

issues:
fix: true
Expand Down Expand Up @@ -145,6 +151,7 @@ linters:
enable-all: true
disable:
# Keep disabled
- intrange
- containedctx
- contextcheck
- cyclop
Expand All @@ -158,7 +165,6 @@ linters:
- gocyclo
- godot
- godox
- goerr113
- gomnd
- gomoddirectives
- inamedparam
Expand All @@ -176,13 +182,5 @@ linters:
- varnamelen
- wsl
# Deprecated
- deadcode
- exhaustivestruct
- golint
- ifshort
- interfacer
- maligned
- nosnakecase
- structcheck
- scopelint
- varcheck
- goerr113
- execinquery
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
rev: v0.0.3
hooks:
- id: check-go-version
args: [ -v=go1.22 ] # Only check minor version locally
args: [ -v=go1.23 ] # Only check minor version locally
pass_filenames: false
additional_dependencies: [ packaging ]
- id: check-licence-header
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit/run_linter.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="1.59.1"
VERSION="1.61.0"

if ! command -v golangci-lint &> /dev/null
then
Expand Down
27 changes: 18 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Container for building Go binary.
FROM golang:1.22.5-bookworm AS builder
FROM golang:1.23.3-bookworm AS builder
# Install dependencies
RUN apt-get update && apt-get install -y build-essential git
RUN apt-get update && apt-get install -y --no-install-recommends build-essential git

# Prep and copy source
WORKDIR /app/charon

COPY . .

# Populate GO_BUILD_FLAG with a build arg to provide an optional go build flag.
ARG GO_BUILD_FLAG
ENV GO_BUILD_FLAG=${GO_BUILD_FLAG}
RUN echo "Building with GO_BUILD_FLAG='${GO_BUILD_FLAG}'"

# Build with Go module and Go build caches.
RUN \
--mount=type=cache,target=/go/pkg \
Expand All @@ -18,30 +22,35 @@ RUN echo "Built charon version=$(./charon version)"

# Copy final binary into light stage.
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates wget fio
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates fio wget \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG GITHUB_SHA=local
ENV GITHUB_SHA=${GITHUB_SHA}

COPY --from=builder /app/charon/charon /usr/local/bin/

# Don't run container as root
ENV USER=charon
ENV UID=1000
ENV GID=1000
RUN addgroup --gid "$GID" "$USER"
RUN adduser \
RUN addgroup --gid "$GID" "$USER" \
&& adduser \
--disabled-password \
--gecos "charon" \
--home "/opt/$USER" \
--ingroup "$USER" \
--no-create-home \
--uid "$UID" \
"$USER"
RUN chown charon /usr/local/bin/charon
RUN chmod u+x /usr/local/bin/charon
"$USER" \
&& chown "$USER" /usr/local/bin/charon \
&& chmod u+x /usr/local/bin/charon

WORKDIR "/opt/$USER"
RUN chown charon "/opt/$USER"
USER charon

ENTRYPOINT ["/usr/local/bin/charon"]
CMD ["run"]

# Used by GitHub to associate container with repo.
LABEL org.opencontainers.image.source="https://github.com/obolnetwork/charon"
LABEL org.opencontainers.image.title="charon"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

This repo contains the source code for the distributed validator client _Charon_ (pronounced 'kharon'); a HTTP middleware client for Ethereum Staking that enables you to safely run a single validator across a group of independent nodes.

Charon is accompanied by a webapp called the [Distributed Validator Launchpad](https://goerli.launchpad.obol.tech/) for distributed validator key creation.
Charon is accompanied by a webapp called the [Distributed Validator Launchpad](https://holesky.launchpad.obol.tech/) for distributed validator key creation.

Charon is used by stakers to distribute the responsibility of running Ethereum Validators across a number of different instances and client implementations.

Expand Down
1 change: 0 additions & 1 deletion app/eth2wrap/httpwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ func httpPost(ctx context.Context, base string, endpoint string, body io.Reader,
return nil, errors.Wrap(err, "failed to read POST response")
}

//nolint:usestdlibvars // we should not replace 100 with http.StatusContinue, it makes it less readable
if res.StatusCode/100 != 2 {
return nil, errors.New("post failed", z.Int("status", res.StatusCode), z.Str("body", string(data)))
}
Expand Down
8 changes: 4 additions & 4 deletions app/expbackoff/expbackoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ func Backoff(config Config, retries int) time.Duration {
}

backoff := float64(config.BaseDelay)
max := float64(config.MaxDelay)
maxVal := float64(config.MaxDelay)

for backoff < max && retries > 0 {
for backoff < maxVal && retries > 0 {
backoff *= config.Multiplier
retries--
}
if backoff > max {
backoff = max
if backoff > maxVal {
backoff = maxVal
}
// Randomize backoff delays so that if a cluster of requests start at
// the same time, they won't operate in lockstep.
Expand Down
16 changes: 8 additions & 8 deletions app/health/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,42 @@ var checks = []check{
Description: "Beacon Node in syncing state.",
Severity: severityCritical,
Func: func(q query, _ Metadata) (bool, error) {
max, err := q("app_monitoring_beacon_node_syncing", noLabels, gaugeMax)
maxVal, err := q("app_monitoring_beacon_node_syncing", noLabels, gaugeMax)
if err != nil {
return false, err
}

return max == 1, nil
return maxVal == 1, nil
},
},
{
Name: "insufficient_connected_peers",
Description: "Not connected to at least quorum peers. Check logs for networking issue or coordinate with peers.",
Severity: severityCritical,
Func: func(q query, m Metadata) (bool, error) {
max, err := q("p2p_ping_success", countNonZeroLabels, gaugeMax)
maxVal, err := q("p2p_ping_success", countNonZeroLabels, gaugeMax)
if err != nil {
return false, err
}

required := float64(m.QuorumPeers) - 1 // Exclude self

return max < required, nil
return maxVal < required, nil
},
},
{
Name: "pending_validators",
Description: "Pending validators detected. Activate them to start validating.",
Severity: severityInfo,
Func: func(q query, _ Metadata) (bool, error) {
max, err := q("core_scheduler_validator_status",
maxVal, err := q("core_scheduler_validator_status",
countLabels(l("status", "pending")),
gaugeMax)
if err != nil {
return false, err
}

return max > 0, nil
return maxVal > 0, nil
},
},
{
Expand Down Expand Up @@ -140,12 +140,12 @@ var checks = []check{
Description: "Metrics reached high cardinality threshold. Please check metrics reported by app_health_metrics_high_cardinality.",
Severity: severityWarning,
Func: func(q query, _ Metadata) (bool, error) {
max, err := q("app_health_metrics_high_cardinality", sumLabels(), gaugeMax)
maxVal, err := q("app_health_metrics_high_cardinality", sumLabels(), gaugeMax)
if err != nil {
return false, err
}

return max > 0, nil
return maxVal > 0, nil
},
},
}
Expand Down
26 changes: 13 additions & 13 deletions app/health/checks_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,19 @@ func testCheck(t *testing.T, m Metadata, checkName string, expect bool, metrics
genGauge(genLabels("bar", "bar2"), 1, 1, 1),
)

var max int
if len(metrics) > max {
max = len(metrics)
var maxVal int
if len(metrics) > maxVal {
maxVal = len(metrics)
}
if len(randomFamFoo) > max {
max = len(randomFamFoo)
if len(randomFamFoo) > maxVal {
maxVal = len(randomFamFoo)
}
if len(randomFamBar) > max {
max = len(randomFamBar)
if len(randomFamBar) > maxVal {
maxVal = len(randomFamBar)
}

multiFams := make([][]*pb.MetricFamily, max)
for i := range max {
multiFams := make([][]*pb.MetricFamily, maxVal)
for i := range maxVal {
var fam []*pb.MetricFamily
if i < len(metrics) {
fam = append(fam, metrics[i])
Expand Down Expand Up @@ -455,14 +455,14 @@ func genFam(name string, metrics ...[]*pb.Metric) []*pb.MetricFamily {
typ = pb.MetricType_GAUGE
}

var max int
var maxVal int
for _, series := range metrics {
if len(series) > max {
max = len(series)
if len(series) > maxVal {
maxVal = len(series)
}
}

resp := make([]*pb.MetricFamily, max)
resp := make([]*pb.MetricFamily, maxVal)
for _, series := range metrics {
for i, metric := range series {
if resp[i] == nil {
Expand Down
Loading
Loading