Compare commits
122 Commits
Author | SHA1 | Date | |
---|---|---|---|
fc9be7fb46 | |||
1dc55cc0c9 | |||
21494e0e7a | |||
0975e8fb4d | |||
8dfa97b54f | |||
439d5cf125 | |||
e02f291db2 | |||
4e64f3f994 | |||
c0b834b0b4 | |||
f937328147 | |||
|
883569bf14 | ||
e32c70a27d | |||
|
8c9abca56e | ||
09c9cbb39f | |||
|
1075d8cf42 | ||
92db4e4209 | |||
|
06ebcd2764 | ||
66878c406f | |||
|
0561824ca3 | ||
|
6210e2ad0c | ||
89c00bb59f | |||
|
8d20f74ec9 | ||
|
e0634128f1 | ||
|
873801833b | ||
160217d9a5 | |||
|
6053ceecc3 | ||
34e909dc98 | |||
|
ae51f8ff7c | ||
f561c77a0d | |||
|
aba9197d2b | ||
f2c3f3d5d1 | |||
|
a702bb558d | ||
aa685064bc | |||
|
7f5ce2e66c | ||
11f849b92d | |||
|
e0c8b29893 | ||
c57e4eedbd | |||
|
b8b9b8ae6b | ||
|
d9f6ca8fae | ||
5ca911c33a | |||
|
09205abdcf | ||
63ab0dbc88 | |||
|
8e21533a35 | ||
|
5c3028d217 | ||
997de86f0f | |||
43d28eca6f | |||
|
49fab99ef6 | ||
|
8f64a205a7 | ||
|
b629031cdc | ||
|
b1082245a6 | ||
|
6b11525d4a | ||
|
f0847578a4 | ||
a0ea7509f7 | |||
|
e30bd45b92 | ||
b6da2df6dc | |||
|
1c8a9d87e8 | ||
|
dbc53d520a | ||
|
ee1616c05b | ||
|
e6cd8bb731 | ||
|
4be3245371 | ||
da1ebc38ca | |||
|
14acb77ab8 | ||
|
9ef586a818 | ||
|
44a26918f9 | ||
95ae9cd371 | |||
|
7cc49c92cd | ||
5517b36e40 | |||
|
7ce39c2bcc | ||
cecd5801cc | |||
|
99063751e1 | ||
6dfd19692d | |||
|
7cc55694f9 | ||
e9bdb73e79 | |||
|
558e2b2360 | ||
d13f36d444 | |||
|
2f6780544e | ||
ce1eeb4af1 | |||
|
79626cb7fb | ||
9afed0bfb0 | |||
eac6b15775 | |||
85319f9bd0 | |||
e4f2c77510 | |||
b77f70aeb0 | |||
bae8886836 | |||
8ad0258828 | |||
d7a9e96561 | |||
4a8caabc52 | |||
5d50b02888 | |||
|
c793eeafda | ||
|
4bad2f0a5f | ||
|
1dac3b9598 | ||
|
c77ac5eed2 | ||
dc498edc1b | |||
326eceddc5 | |||
|
071a135a70 | ||
336b128033 | |||
4579965c49 | |||
944294f19f | |||
|
2a6371c797 | ||
|
629a3fee48 | ||
6dc3d858d6 | |||
|
e7797e2e46 | ||
1a03f7e25f | |||
50d21479fd | |||
2f8021fe00 | |||
0571f46d75 | |||
13843fbcf4 | |||
|
d4d0604412 | ||
fe897ee428 | |||
|
d142fc6e91 | ||
2d918e9f5a | |||
|
6d80445682 | ||
bb514b5dc2 | |||
|
b79261650a | ||
62c424c47f | |||
|
078a9c9391 | ||
45a8351d5e | |||
|
4eb66bfe99 | ||
54aee07622 | |||
|
357455f07d | ||
9b86861918 | |||
|
5fa2e1bef0 |
20
.github/workflows/autoapprove.yml
vendored
Normal file
20
.github/workflows/autoapprove.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: "autoapprove"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [assigned, opened, synchronize, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autoapprove:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: approve
|
||||||
|
uses: hmarr/auto-approve-action@v3
|
||||||
|
if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]'
|
||||||
|
id: approve
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
21
.github/workflows/automerge.yml
vendored
Normal file
21
.github/workflows/automerge.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: "automerge"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [assigned, opened, synchronize, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
automerge:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.actor == 'vtolstov'
|
||||||
|
steps:
|
||||||
|
- name: merge
|
||||||
|
id: merge
|
||||||
|
run: gh pr merge --auto --merge "$PR_URL"
|
||||||
|
env:
|
||||||
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
|
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@@ -3,19 +3,20 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- v3
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: test
|
name: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: setup
|
- name: setup
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: 1.17
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: cache
|
- name: cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: ~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
@@ -31,9 +32,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: lint
|
- name: lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v3.4.0
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||||
|
12
.github/workflows/codeql-analysis.yml
vendored
12
.github/workflows/codeql-analysis.yml
vendored
@@ -43,14 +43,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup
|
- name: setup
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: 1.17
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: init
|
- name: init
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# 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)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: autobuild
|
- name: autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -75,4 +75,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: analyze
|
- name: analyze
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
14
.github/workflows/dependabot-automerge.yml
vendored
14
.github/workflows/dependabot-automerge.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: "prautomerge"
|
name: "dependabot-automerge"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
@@ -9,21 +9,17 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dependabot:
|
automerge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
if: github.actor == 'dependabot[bot]'
|
||||||
steps:
|
steps:
|
||||||
- name: metadata
|
- name: metadata
|
||||||
id: metadata
|
id: metadata
|
||||||
uses: dependabot/fetch-metadata@v1.1.1
|
uses: dependabot/fetch-metadata@v1.3.6
|
||||||
with:
|
with:
|
||||||
github-token: "${{ secrets.TOKEN }}"
|
github-token: "${{ secrets.TOKEN }}"
|
||||||
- name: approve
|
|
||||||
run: gh pr review --approve "$PR_URL"
|
|
||||||
env:
|
|
||||||
PR_URL: ${{github.event.pull_request.html_url}}
|
|
||||||
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
|
||||||
- name: merge
|
- name: merge
|
||||||
|
id: merge
|
||||||
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
|
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
|
||||||
run: gh pr merge --auto --merge "$PR_URL"
|
run: gh pr merge --auto --merge "$PR_URL"
|
||||||
env:
|
env:
|
||||||
|
13
.github/workflows/pr.yml
vendored
13
.github/workflows/pr.yml
vendored
@@ -3,19 +3,20 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- v3
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: test
|
name: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: setup
|
- name: setup
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: 1.17
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: cache
|
- name: cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: ~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
@@ -31,9 +32,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: lint
|
- name: lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v3.4.0
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||||
|
25
go.mod
25
go.mod
@@ -1,10 +1,25 @@
|
|||||||
module go.unistack.org/micro-meter-prometheus/v3
|
module go.unistack.org/micro-meter-prometheus/v3
|
||||||
|
|
||||||
go 1.16
|
go 1.21
|
||||||
|
|
||||||
|
toolchain go1.22.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/prometheus/client_golang v1.11.0
|
github.com/prometheus/client_golang v1.20.4
|
||||||
github.com/prometheus/client_model v0.2.0
|
github.com/prometheus/client_model v0.6.1
|
||||||
github.com/prometheus/common v0.26.0
|
github.com/prometheus/common v0.59.1
|
||||||
go.unistack.org/micro/v3 v3.8.7
|
go.unistack.org/micro/v3 v3.10.91
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
|
go.unistack.org/micro-proto/v3 v3.4.1 // indirect
|
||||||
|
golang.org/x/sys v0.25.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
|
||||||
|
google.golang.org/grpc v1.57.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.34.2 // indirect
|
||||||
)
|
)
|
||||||
|
194
go.sum
194
go.sum
@@ -1,156 +1,46 @@
|
|||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
|
||||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||||
github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ=
|
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
go.unistack.org/micro-proto/v3 v3.4.1 h1:UTjLSRz2YZuaHk9iSlVqqsA50JQNAEK2ZFboGqtEa9Q=
|
||||||
github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ=
|
go.unistack.org/micro-proto/v3 v3.4.1/go.mod h1:okx/cnOhzuCX0ggl/vToatbCupi0O44diiiLLsZ93Zo=
|
||||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
go.unistack.org/micro/v3 v3.10.90 h1:EE7t4J14yjZC/lW6e0BfiBnU/xt/KqGkqSxumJhI/fI=
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
go.unistack.org/micro/v3 v3.10.90/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
go.unistack.org/micro/v3 v3.10.91 h1:vuJY4tXwpqimwIkEJ3TozMYNVQQs+C5QMlQWPgSY/YM=
|
||||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
go.unistack.org/micro/v3 v3.10.91/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
|
||||||
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||||
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
||||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||||
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
|
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||||
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
|
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
|
||||||
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
|
413
prometheus.go
413
prometheus.go
@@ -2,7 +2,9 @@ package prometheus
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"hash/fnv"
|
||||||
"io"
|
"io"
|
||||||
|
"regexp"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -13,190 +15,210 @@ import (
|
|||||||
"go.unistack.org/micro/v3/meter"
|
"go.unistack.org/micro/v3/meter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ meter.Meter = (*prometheusMeter)(nil)
|
||||||
|
|
||||||
type prometheusMeter struct {
|
type prometheusMeter struct {
|
||||||
opts meter.Options
|
opts meter.Options
|
||||||
set prometheus.Registerer
|
set prometheus.Registerer
|
||||||
counter map[string]prometheusCounter
|
counter *sync.Map
|
||||||
floatCounter map[string]prometheusFloatCounter
|
floatCounter *sync.Map
|
||||||
gauge map[string]prometheusGauge
|
gauge *sync.Map
|
||||||
histogram map[string]prometheusHistogram
|
histogram *sync.Map
|
||||||
summary map[string]prometheusSummary
|
summary *sync.Map
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMeter(opts ...meter.Option) meter.Meter {
|
type counters struct {
|
||||||
|
cs *sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
type gauges struct {
|
||||||
|
cs *sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
type histograms struct {
|
||||||
|
cs *sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
type summaries struct {
|
||||||
|
cs *sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
type floatCounters struct {
|
||||||
|
cs *sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMeter(opts ...meter.Option) *prometheusMeter {
|
||||||
return &prometheusMeter{
|
return &prometheusMeter{
|
||||||
set: prometheus.DefaultRegisterer,
|
set: prometheus.NewRegistry(), // prometheus.DefaultRegisterer,
|
||||||
opts: meter.NewOptions(opts...),
|
opts: meter.NewOptions(opts...),
|
||||||
counter: make(map[string]prometheusCounter),
|
counter: &sync.Map{},
|
||||||
floatCounter: make(map[string]prometheusFloatCounter),
|
floatCounter: &sync.Map{},
|
||||||
gauge: make(map[string]prometheusGauge),
|
gauge: &sync.Map{},
|
||||||
histogram: make(map[string]prometheusHistogram),
|
histogram: &sync.Map{},
|
||||||
summary: make(map[string]prometheusSummary),
|
summary: &sync.Map{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) buildMetric(name string, labels ...string) string {
|
|
||||||
if len(m.opts.MetricPrefix) > 0 {
|
|
||||||
name = m.opts.MetricPrefix + name
|
|
||||||
}
|
|
||||||
|
|
||||||
nl := len(m.opts.Labels) + len(labels)
|
|
||||||
if nl == 0 {
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
|
|
||||||
nlabels := make([]string, 0, nl)
|
|
||||||
nlabels = append(nlabels, m.opts.Labels...)
|
|
||||||
nlabels = append(nlabels, labels...)
|
|
||||||
|
|
||||||
if len(m.opts.LabelPrefix) == 0 {
|
|
||||||
return meter.BuildName(name, nlabels...)
|
|
||||||
}
|
|
||||||
|
|
||||||
for idx := 0; idx < nl; idx++ {
|
|
||||||
nlabels[idx] = m.opts.LabelPrefix + nlabels[idx]
|
|
||||||
idx++
|
|
||||||
}
|
|
||||||
return meter.BuildName(name, nlabels...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *prometheusMeter) buildName(name string) string {
|
|
||||||
if len(m.opts.MetricPrefix) > 0 {
|
|
||||||
name = m.opts.MetricPrefix + name
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *prometheusMeter) buildLabels(labels ...string) []string {
|
|
||||||
nl := len(m.opts.Labels) + len(labels)
|
|
||||||
if nl == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
nlabels := make([]string, 0, nl)
|
|
||||||
nlabels = append(nlabels, m.opts.Labels...)
|
|
||||||
nlabels = append(nlabels, labels...)
|
|
||||||
|
|
||||||
for idx := 0; idx < nl; idx++ {
|
|
||||||
nlabels[idx] = m.opts.LabelPrefix + nlabels[idx]
|
|
||||||
idx++
|
|
||||||
}
|
|
||||||
return nlabels
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *prometheusMeter) Name() string {
|
func (m *prometheusMeter) Name() string {
|
||||||
return m.opts.Name
|
return m.opts.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) mapLabels(labels ...string) map[string]string {
|
|
||||||
labels = m.buildLabels(labels...)
|
|
||||||
elementMap := make(map[string]string, len(labels)/2)
|
|
||||||
for idx := 0; idx < len(labels); idx++ {
|
|
||||||
elementMap[labels[idx]] = labels[idx+1]
|
|
||||||
idx++
|
|
||||||
}
|
|
||||||
return elementMap
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *prometheusMeter) Counter(name string, labels ...string) meter.Counter {
|
func (m *prometheusMeter) Counter(name string, labels ...string) meter.Counter {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.counter.Load(name)
|
||||||
c, ok := m.counter[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewGauge(prometheus.GaugeOpts{Name: m.buildName(name), ConstLabels: m.mapLabels(labels...)})
|
cd := &counters{cs: &sync.Map{}}
|
||||||
m.set.MustRegister(nc)
|
c := &prometheusCounter{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
c = prometheusCounter{c: nc}
|
cd.cs.Store(h, c)
|
||||||
m.counter[nm] = c
|
m.counter.Store(name, cd)
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*counters)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusCounter{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.counter.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusCounter)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) FloatCounter(name string, labels ...string) meter.FloatCounter {
|
func (m *prometheusMeter) FloatCounter(name string, labels ...string) meter.FloatCounter {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.floatCounter.Load(name)
|
||||||
c, ok := m.floatCounter[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewGauge(prometheus.GaugeOpts{Name: m.buildName(name), ConstLabels: m.mapLabels(labels...)})
|
cd := &floatCounters{cs: &sync.Map{}}
|
||||||
m.set.MustRegister(nc)
|
c := &prometheusFloatCounter{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
c = prometheusFloatCounter{c: nc}
|
cd.cs.Store(h, c)
|
||||||
m.floatCounter[nm] = c
|
m.floatCounter.Store(name, cd)
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*floatCounters)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusFloatCounter{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.floatCounter.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusFloatCounter)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) Gauge(name string, fn func() float64, labels ...string) meter.Gauge {
|
func (m *prometheusMeter) Gauge(name string, fn func() float64, labels ...string) meter.Gauge {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.gauge.Load(name)
|
||||||
c, ok := m.gauge[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewGauge(prometheus.GaugeOpts{Name: m.buildName(name), ConstLabels: m.mapLabels(labels...)})
|
cd := &gauges{cs: &sync.Map{}}
|
||||||
m.set.MustRegister(nc)
|
c := &prometheusGauge{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
c = prometheusGauge{c: nc}
|
cd.cs.Store(h, c)
|
||||||
m.gauge[nm] = c
|
m.gauge.Store(name, cd)
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*gauges)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusGauge{c: prometheus.NewGauge(prometheus.GaugeOpts{Name: name}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.gauge.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusGauge)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) Histogram(name string, labels ...string) meter.Histogram {
|
func (m *prometheusMeter) Histogram(name string, labels ...string) meter.Histogram {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.histogram.Load(name)
|
||||||
c, ok := m.histogram[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewHistogram(prometheus.HistogramOpts{Name: m.buildName(name), ConstLabels: m.mapLabels(labels...)})
|
cd := &histograms{cs: &sync.Map{}}
|
||||||
m.set.MustRegister(nc)
|
c := &prometheusHistogram{c: prometheus.NewHistogram(prometheus.HistogramOpts{Name: name}), labels: labels}
|
||||||
c = prometheusHistogram{c: nc}
|
cd.cs.Store(h, c)
|
||||||
m.histogram[nm] = c
|
m.histogram.Store(name, cd)
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*histograms)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusHistogram{c: prometheus.NewHistogram(prometheus.HistogramOpts{Name: name}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.histogram.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusHistogram)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) Summary(name string, labels ...string) meter.Summary {
|
func (m *prometheusMeter) Summary(name string, labels ...string) meter.Summary {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.summary.Load(name)
|
||||||
c, ok := m.summary[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewSummary(prometheus.SummaryOpts{Name: m.buildName(name), ConstLabels: m.mapLabels(labels...)})
|
cd := &summaries{cs: &sync.Map{}}
|
||||||
m.set.MustRegister(nc)
|
c := &prometheusSummary{c: prometheus.NewSummary(prometheus.SummaryOpts{Name: name}), labels: labels}
|
||||||
c = prometheusSummary{c: nc}
|
cd.cs.Store(h, c)
|
||||||
m.summary[nm] = c
|
m.summary.Store(name, cd)
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*summaries)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusSummary{c: prometheus.NewSummary(prometheus.SummaryOpts{Name: name}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.summary.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusSummary)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *prometheusMeter) SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) meter.Summary {
|
func (m *prometheusMeter) SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) meter.Summary {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
defer m.Unlock()
|
defer m.Unlock()
|
||||||
|
labels = append(m.opts.Labels, labels...)
|
||||||
nm := m.buildMetric(name, labels...)
|
vcd, ok := m.summary.Load(name)
|
||||||
c, ok := m.summary[nm]
|
h := newHash(labels)
|
||||||
if !ok {
|
if !ok {
|
||||||
nc := prometheus.NewSummary(prometheus.SummaryOpts{
|
cd := &summaries{cs: &sync.Map{}}
|
||||||
Name: m.buildName(name),
|
c := &prometheusSummary{c: prometheus.NewSummary(prometheus.SummaryOpts{
|
||||||
ConstLabels: m.mapLabels(labels...),
|
Name: name,
|
||||||
MaxAge: window,
|
MaxAge: window,
|
||||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
|
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
|
||||||
})
|
}), labels: labels}
|
||||||
m.set.MustRegister(nc)
|
cd.cs.Store(h, c)
|
||||||
c = prometheusSummary{c: nc}
|
m.summary.Store(name, cd)
|
||||||
m.summary[nm] = c
|
return c
|
||||||
}
|
}
|
||||||
|
cd := vcd.(*summaries)
|
||||||
|
vc, ok := cd.cs.Load(h)
|
||||||
|
if !ok {
|
||||||
|
c := &prometheusSummary{c: prometheus.NewSummary(prometheus.SummaryOpts{
|
||||||
|
Name: name,
|
||||||
|
MaxAge: window,
|
||||||
|
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
|
||||||
|
}), labels: labels}
|
||||||
|
cd.cs.Store(h, c)
|
||||||
|
m.summary.Store(name, cd)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
c := vc.(*prometheusSummary)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +227,13 @@ func (m *prometheusMeter) Init(opts ...meter.Option) error {
|
|||||||
o(&m.opts)
|
o(&m.opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.opts.WriteProcessMetrics || m.opts.WriteFDMetrics {
|
||||||
|
pc := collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})
|
||||||
|
_ = m.set.Register(pc)
|
||||||
|
gc := collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}))
|
||||||
|
_ = m.set.Register(gc)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,11 +243,6 @@ func (m *prometheusMeter) Write(w io.Writer, opts ...meter.Option) error {
|
|||||||
o(&options)
|
o(&options)
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.WriteProcessMetrics || options.WriteFDMetrics {
|
|
||||||
c := collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})
|
|
||||||
_ = m.set.Register(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
g, ok := m.set.(prometheus.Gatherer)
|
g, ok := m.set.(prometheus.Gatherer)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("set type %T not prometheus.Gatherer", m.set)
|
return fmt.Errorf("set type %T not prometheus.Gatherer", m.set)
|
||||||
@@ -229,7 +253,98 @@ func (m *prometheusMeter) Write(w io.Writer, opts ...meter.Option) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
enc := expfmt.NewEncoder(w, expfmt.FmtText)
|
enc := expfmt.NewEncoder(w, expfmt.NewFormat(expfmt.TypeTextPlain))
|
||||||
|
|
||||||
|
m.counter.Range(func(k, v any) bool {
|
||||||
|
name := k.(string)
|
||||||
|
mf := &dto.MetricFamily{
|
||||||
|
Name: &name,
|
||||||
|
Type: dto.MetricType_GAUGE.Enum(),
|
||||||
|
}
|
||||||
|
v.(*counters).cs.Range(func(_, nv any) bool {
|
||||||
|
c := nv.(*prometheusCounter)
|
||||||
|
m := &dto.Metric{}
|
||||||
|
_ = c.c.Write(m)
|
||||||
|
fillMetric(m, c.labels)
|
||||||
|
mf.Metric = append(mf.Metric, m)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
mfs = append(mfs, mf)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
m.gauge.Range(func(k, v any) bool {
|
||||||
|
name := k.(string)
|
||||||
|
mf := &dto.MetricFamily{
|
||||||
|
Name: &name,
|
||||||
|
Type: dto.MetricType_GAUGE.Enum(),
|
||||||
|
}
|
||||||
|
v.(*gauges).cs.Range(func(_, nv any) bool {
|
||||||
|
c := nv.(*prometheusGauge)
|
||||||
|
m := &dto.Metric{}
|
||||||
|
_ = c.c.Write(m)
|
||||||
|
fillMetric(m, c.labels)
|
||||||
|
mf.Metric = append(mf.Metric, m)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
mfs = append(mfs, mf)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
m.floatCounter.Range(func(k, v any) bool {
|
||||||
|
name := k.(string)
|
||||||
|
mf := &dto.MetricFamily{
|
||||||
|
Name: &name,
|
||||||
|
Type: dto.MetricType_GAUGE.Enum(),
|
||||||
|
}
|
||||||
|
v.(*floatCounters).cs.Range(func(_, nv any) bool {
|
||||||
|
c := nv.(*prometheusFloatCounter)
|
||||||
|
m := &dto.Metric{}
|
||||||
|
_ = c.c.Write(m)
|
||||||
|
fillMetric(m, c.labels)
|
||||||
|
mf.Metric = append(mf.Metric, m)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
mfs = append(mfs, mf)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
m.histogram.Range(func(k, v any) bool {
|
||||||
|
name := k.(string)
|
||||||
|
mf := &dto.MetricFamily{
|
||||||
|
Name: &name,
|
||||||
|
Type: dto.MetricType_HISTOGRAM.Enum(),
|
||||||
|
}
|
||||||
|
v.(*histograms).cs.Range(func(_, nv any) bool {
|
||||||
|
c := nv.(*prometheusHistogram)
|
||||||
|
m := &dto.Metric{}
|
||||||
|
_ = c.c.Write(m)
|
||||||
|
fillMetric(m, c.labels)
|
||||||
|
mf.Metric = append(mf.Metric, m)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
mfs = append(mfs, mf)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
m.summary.Range(func(k, v any) bool {
|
||||||
|
name := k.(string)
|
||||||
|
mf := &dto.MetricFamily{
|
||||||
|
Name: &name,
|
||||||
|
Type: dto.MetricType_SUMMARY.Enum(),
|
||||||
|
}
|
||||||
|
v.(*summaries).cs.Range(func(_, nv any) bool {
|
||||||
|
c := nv.(*prometheusSummary)
|
||||||
|
m := &dto.Metric{}
|
||||||
|
_ = c.c.Write(m)
|
||||||
|
fillMetric(m, c.labels)
|
||||||
|
mf.Metric = append(mf.Metric, m)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
mfs = append(mfs, mf)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
for _, mf := range mfs {
|
for _, mf := range mfs {
|
||||||
_ = enc.Encode(mf)
|
_ = enc.Encode(mf)
|
||||||
}
|
}
|
||||||
@@ -250,6 +365,7 @@ func (m *prometheusMeter) Clone(opts ...meter.Option) meter.Meter {
|
|||||||
return &prometheusMeter{
|
return &prometheusMeter{
|
||||||
set: m.set,
|
set: m.set,
|
||||||
opts: options,
|
opts: options,
|
||||||
|
floatCounter: m.floatCounter,
|
||||||
counter: m.counter,
|
counter: m.counter,
|
||||||
gauge: m.gauge,
|
gauge: m.gauge,
|
||||||
histogram: m.histogram,
|
histogram: m.histogram,
|
||||||
@@ -276,21 +392,22 @@ func (m *prometheusMeter) Set(opts ...meter.Option) meter.Meter {
|
|||||||
|
|
||||||
type prometheusCounter struct {
|
type prometheusCounter struct {
|
||||||
c prometheus.Gauge
|
c prometheus.Gauge
|
||||||
|
labels []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusCounter) Add(n int) {
|
func (c *prometheusCounter) Add(n int) {
|
||||||
c.c.Add(float64(n))
|
c.c.Add(float64(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusCounter) Dec() {
|
func (c *prometheusCounter) Dec() {
|
||||||
c.c.Dec()
|
c.c.Dec()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusCounter) Inc() {
|
func (c *prometheusCounter) Inc() {
|
||||||
c.c.Inc()
|
c.c.Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusCounter) Get() uint64 {
|
func (c *prometheusCounter) Get() uint64 {
|
||||||
m := &dto.Metric{}
|
m := &dto.Metric{}
|
||||||
if err := c.c.Write(m); err != nil {
|
if err := c.c.Write(m); err != nil {
|
||||||
return 0
|
return 0
|
||||||
@@ -298,12 +415,13 @@ func (c prometheusCounter) Get() uint64 {
|
|||||||
return uint64(m.GetGauge().GetValue())
|
return uint64(m.GetGauge().GetValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusCounter) Set(n uint64) {
|
func (c *prometheusCounter) Set(n uint64) {
|
||||||
c.c.Set(float64(n))
|
c.c.Set(float64(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
type prometheusFloatCounter struct {
|
type prometheusFloatCounter struct {
|
||||||
c prometheus.Gauge
|
c prometheus.Gauge
|
||||||
|
labels []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusFloatCounter) Add(n float64) {
|
func (c prometheusFloatCounter) Add(n float64) {
|
||||||
@@ -328,6 +446,7 @@ func (c prometheusFloatCounter) Sub(n float64) {
|
|||||||
|
|
||||||
type prometheusGauge struct {
|
type prometheusGauge struct {
|
||||||
c prometheus.Gauge
|
c prometheus.Gauge
|
||||||
|
labels []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusGauge) Get() float64 {
|
func (c prometheusGauge) Get() float64 {
|
||||||
@@ -340,6 +459,7 @@ func (c prometheusGauge) Get() float64 {
|
|||||||
|
|
||||||
type prometheusHistogram struct {
|
type prometheusHistogram struct {
|
||||||
c prometheus.Histogram
|
c prometheus.Histogram
|
||||||
|
labels []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusHistogram) Reset() {
|
func (c prometheusHistogram) Reset() {
|
||||||
@@ -355,6 +475,7 @@ func (c prometheusHistogram) UpdateDuration(n time.Time) {
|
|||||||
|
|
||||||
type prometheusSummary struct {
|
type prometheusSummary struct {
|
||||||
c prometheus.Summary
|
c prometheus.Summary
|
||||||
|
labels []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c prometheusSummary) Update(n float64) {
|
func (c prometheusSummary) Update(n float64) {
|
||||||
@@ -364,3 +485,29 @@ func (c prometheusSummary) Update(n float64) {
|
|||||||
func (c prometheusSummary) UpdateDuration(n time.Time) {
|
func (c prometheusSummary) UpdateDuration(n time.Time) {
|
||||||
c.c.Observe(time.Since(n).Seconds())
|
c.c.Observe(time.Since(n).Seconds())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newHash(labels []string) uint64 {
|
||||||
|
labels = meter.BuildLabels(labels...)
|
||||||
|
h := fnv.New64a()
|
||||||
|
for _, l := range labels {
|
||||||
|
h.Write([]byte(l))
|
||||||
|
}
|
||||||
|
return h.Sum64()
|
||||||
|
}
|
||||||
|
|
||||||
|
func fillMetric(m *dto.Metric, labels []string) *dto.Metric {
|
||||||
|
var ok bool
|
||||||
|
seen := make(map[string]bool, len(labels)/2)
|
||||||
|
m.Label = make([]*dto.LabelPair, 0, len(labels)/2)
|
||||||
|
for idx := 0; idx < len(labels); idx += 2 {
|
||||||
|
if _, ok = seen[labels[idx]]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
m.Label = append(m.Label, &dto.LabelPair{
|
||||||
|
Name: &(labels[idx]),
|
||||||
|
Value: &(labels[idx+1]),
|
||||||
|
})
|
||||||
|
seen[labels[idx]] = true
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
@@ -8,35 +8,26 @@ import (
|
|||||||
"go.unistack.org/micro/v3/client"
|
"go.unistack.org/micro/v3/client"
|
||||||
"go.unistack.org/micro/v3/codec"
|
"go.unistack.org/micro/v3/codec"
|
||||||
"go.unistack.org/micro/v3/meter"
|
"go.unistack.org/micro/v3/meter"
|
||||||
"go.unistack.org/micro/v3/meter/wrapper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildName(t *testing.T) {
|
func TestStd(t *testing.T) {
|
||||||
m := NewMeter()
|
m := NewMeter(meter.WriteProcessMetrics(true), meter.WriteFDMetrics(true))
|
||||||
im := m.(*prometheusMeter)
|
if err := m.Init(); err != nil {
|
||||||
check := `micro_foo{micro_aaa="b",micro_bar="baz",micro_ccc="d"}`
|
t.Fatal(err)
|
||||||
name := im.buildMetric("foo", "bar", "baz", "aaa", "b", "ccc", "d")
|
}
|
||||||
if name != check {
|
buf := bytes.NewBuffer(nil)
|
||||||
t.Fatalf("metric name error: %s != %s", name, check)
|
_ = m.Write(buf)
|
||||||
|
if !bytes.Contains(buf.Bytes(), []byte(`go_goroutine`)) {
|
||||||
|
t.Fatalf("invalid metrics output: %s", buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt := m.Counter("counter", "key", "val")
|
|
||||||
cnt.Inc()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWrapper(t *testing.T) {
|
func TestWrapper(t *testing.T) {
|
||||||
m := NewMeter() // meter.Labels("test_key", "test_val"))
|
m := NewMeter() // meter.Labels("test_key", "test_val"))
|
||||||
|
|
||||||
w := wrapper.NewClientWrapper(
|
|
||||||
wrapper.ServiceName("svc1"),
|
|
||||||
wrapper.ServiceVersion("0.0.1"),
|
|
||||||
wrapper.ServiceID("12345"),
|
|
||||||
wrapper.Meter(m),
|
|
||||||
)
|
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
c := client.NewClient(client.Wrap(w))
|
c := client.NewClient(client.Meter(m))
|
||||||
if err := c.Init(); err != nil {
|
if err := c.Init(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -46,7 +37,26 @@ func TestWrapper(t *testing.T) {
|
|||||||
_, _ = rsp, err
|
_, _ = rsp, err
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
_ = m.Write(buf, meter.WriteProcessMetrics(false), meter.WriteFDMetrics(false))
|
_ = m.Write(buf, meter.WriteProcessMetrics(false), meter.WriteFDMetrics(false))
|
||||||
if !bytes.Contains(buf.Bytes(), []byte(`micro_client_request_inflight{micro_endpoint="svc2.Service.Method"} 0`)) {
|
if !bytes.Contains(buf.Bytes(), []byte(`micro_client_request_inflight{endpoint="Service.Method"} 0`)) {
|
||||||
|
t.Fatalf("invalid metrics output: %s", buf.Bytes())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMultiple(t *testing.T) {
|
||||||
|
m := NewMeter() // meter.Labels("test_key", "test_val"))
|
||||||
|
|
||||||
|
m.Counter("micro_server", "endpoint", "ep1", "path", "/path1").Inc()
|
||||||
|
m.Counter("micro_server", "endpoint", "ep1", "path", "/path1").Inc()
|
||||||
|
|
||||||
|
m.Counter("micro_server", "endpoint", "ep2", "path", "/path2").Inc()
|
||||||
|
m.Counter("micro_server", "endpoint", "ep2", "path", "/path2").Inc()
|
||||||
|
|
||||||
|
m.Counter("micro_server", "endpoint", "ep3", "path", "/path3", "status", "success").Inc()
|
||||||
|
|
||||||
|
buf := bytes.NewBuffer(nil)
|
||||||
|
_ = m.Write(buf, meter.WriteProcessMetrics(false), meter.WriteFDMetrics(false))
|
||||||
|
if !bytes.Contains(buf.Bytes(), []byte(`micro_server{endpoint="ep1",path="/path1"} 2`)) {
|
||||||
|
// t.Fatal("XXXX")
|
||||||
t.Fatalf("invalid metrics output: %s", buf.Bytes())
|
t.Fatalf("invalid metrics output: %s", buf.Bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user