84 Commits

Author SHA1 Message Date
b2b7e9b1a2 optimization
Some checks failed
coverage / build (push) Successful in 3m14s
sync / sync (push) Successful in 2m22s
test / test (push) Failing after 18m21s
* update micro

* add benchmark

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-06-17 19:04:00 +03:00
5cbaca0068 add prometheus compatible histogram
Some checks failed
coverage / build (push) Failing after 34s
test / test (push) Successful in 4m53s
sync / sync (push) Successful in 6s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-06-16 19:20:49 +03:00
vtolstov
c2ea781b28 Apply Code Coverage Badge 2025-05-05 16:32:18 +00:00
c1e2eda3e5 [v4] update ci (#167)
All checks were successful
coverage / build (push) Successful in 4m48s
sync / sync (push) Successful in 11m34s
test / test (push) Successful in 13m25s
* update ci

* added commit hash check to avoid unnecessary repository cloning
2025-05-05 19:24:50 +03:00
88a553d931 improve sync
Some checks failed
coverage / build (push) Failing after 5m47s
test / test (push) Successful in 11m21s
codeql / analyze (go) (push) Failing after 20m0s
sync / sync (push) Successful in 14s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-04-27 21:37:52 +03:00
b56bb7f834 enable ci
All checks were successful
test / test (push) Successful in 2m38s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-03-04 11:26:23 +03:00
a08cbee842 update to latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-03-04 11:25:09 +03:00
a8b6d67344 Merge pull request 'micro v4 options fix' (#115) from options into master
Some checks failed
build / test (push) Failing after 1m35s
build / lint (push) Successful in 12s
codeql / analyze (go) (push) Failing after 1m15s
Reviewed-on: #115
2023-08-16 15:32:29 +03:00
3f589b20c4 micro v4 options fix
Some checks failed
autoapprove / autoapprove (pull_request) Failing after 11s
automerge / automerge (pull_request) Failing after 7s
codeql / analyze (go) (pull_request) Failing after 3m30s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m59s
prbuild / lint (pull_request) Successful in 24s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-16 15:32:09 +03:00
78571b68ab Merge pull request 'move to micro v4' (#114) from v4 into master
Reviewed-on: #114
2023-05-07 19:27:20 +03:00
e1f18b0a9b move to micro v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-07 19:26:50 +03:00
279853ccb5 update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 19:09:34 +03:00
ec4f5f084f Merge pull request #65 from unistack-org/dependabot/github_actions/golangci/golangci-lint-action-3
Bump golangci/golangci-lint-action from 2 to 3
2022-02-25 14:37:12 +03:00
dependabot[bot]
a6707dcac4 Bump golangci/golangci-lint-action from 2 to 3
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-25 11:35:18 +00:00
088a00dc79 Merge pull request #64 from unistack-org/dependabot/github_actions/dependabot/fetch-metadata-1.2.1
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
2022-02-25 14:34:43 +03:00
dependabot[bot]
fdc0017341 Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.1.1...v1.2.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-23 11:21:05 +00:00
61fe743eef Merge pull request #61 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.21
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
2022-02-07 09:30:52 +03:00
dependabot[bot]
2bd03c4496 Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.20 to 3.8.21.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.20...v3.8.21)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-31 11:22:58 +00:00
cf2a186f29 Merge pull request #60 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.20
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
2022-01-26 14:22:34 +03:00
dependabot[bot]
84a28ff806 Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.19 to 3.8.20.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.19...v3.8.20)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-26 11:20:51 +00:00
7d7d3566e3 Merge pull request #59 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.19
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
2022-01-25 14:18:29 +03:00
dependabot[bot]
49bfe33435 Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.18 to 3.8.19.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.18...v3.8.19)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-25 11:16:55 +00:00
620495eabb Merge pull request #58 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.18
Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
2022-01-24 14:27:02 +03:00
dependabot[bot]
f965485d01 Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.16 to 3.8.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.16...v3.8.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-24 11:25:38 +00:00
a5499d08fe Merge pull request #57 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.16
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
2022-01-21 14:17:41 +03:00
dependabot[bot]
e431b6a7a6 Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.15 to 3.8.16.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.15...v3.8.16)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-21 11:16:30 +00:00
8c5f186cdc Merge pull request #56 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.15
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
2022-01-20 14:27:44 +03:00
dependabot[bot]
f0ac1b9e29 Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.14 to 3.8.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.14...v3.8.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-20 11:26:01 +00:00
1e84dab453 Merge pull request #55 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.14
Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.14
2022-01-11 14:27:47 +03:00
dependabot[bot]
00a84da9e6 Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.11 to 3.8.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.11...v3.8.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 11:26:22 +00:00
8b9d9c96d9 Merge pull request #52 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.11
Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
2021-11-24 14:20:18 +03:00
dependabot[bot]
f4a93ba605 Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.10 to 3.8.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.10...v3.8.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-24 11:19:02 +00:00
153f4073b8 Merge pull request #51 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.10
Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.10
2021-11-19 14:20:09 +03:00
dependabot[bot]
40f1fe4732 Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.7 to 3.8.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.7...v3.8.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-19 11:18:37 +00:00
cd50cc5366 Merge pull request #50 from unistack-org/dependabot/go_modules/github.com/VictoriaMetrics/metrics-1.18.1
Bump github.com/VictoriaMetrics/metrics from 1.18.0 to 1.18.1
2021-11-02 14:20:11 +03:00
dependabot[bot]
5128671bd0 Bump github.com/VictoriaMetrics/metrics from 1.18.0 to 1.18.1
Bumps [github.com/VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/VictoriaMetrics/metrics/releases)
- [Commits](https://github.com/VictoriaMetrics/metrics/compare/v1.18.0...v1.18.1)

---
updated-dependencies:
- dependency-name: github.com/VictoriaMetrics/metrics
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 11:17:21 +00:00
e33004352b Merge pull request #49 from unistack-org/labels_fix
fixup metric labels helper
2021-10-31 14:47:22 +03:00
b308e073a0 fixup metric labels helper
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-31 14:46:40 +03:00
a65561a85e Merge pull request #48 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.7
Bump go.unistack.org/micro/v3 from 3.8.6 to 3.8.7
2021-10-28 14:21:19 +03:00
dependabot[bot]
f5e7889daf Bump go.unistack.org/micro/v3 from 3.8.6 to 3.8.7
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.6 to 3.8.7.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.6...v3.8.7)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 11:19:47 +00:00
a167fd531e update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 18:59:12 +03:00
ab247ef9c6 fix default labels
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-10 00:35:16 +03:00
28ebe788da add Clone method
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-09 23:56:12 +03:00
7dd349a607 use own domain
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-09 01:14:16 +03:00
github-actions[bot]
0072481aa7 Merge pull request #41 from unistack-org/dependabot/github_actions/actions/github-script-5
Bump actions/github-script from 4 to 5
2021-09-27 11:15:38 +00:00
dependabot[bot]
f2af3ea947 Bump actions/github-script from 4 to 5
Bumps [actions/github-script](https://github.com/actions/github-script) from 4 to 5.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-27 11:14:33 +00:00
github-actions[bot]
cd985a8a56 Merge pull request #40 from unistack-org/dependabot/go_modules/github.com/unistack-org/micro/v3-3.7.4
Bump github.com/unistack-org/micro/v3 from 3.7.3 to 3.7.4
2021-09-23 11:20:04 +00:00
dependabot[bot]
aebfa6ffaf Bump github.com/unistack-org/micro/v3 from 3.7.3 to 3.7.4
Bumps [github.com/unistack-org/micro/v3](https://github.com/unistack-org/micro) from 3.7.3 to 3.7.4.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.7.3...v3.7.4)

---
updated-dependencies:
- dependency-name: github.com/unistack-org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-23 11:19:00 +00:00
github-actions[bot]
071a3ca163 Merge pull request #39 from unistack-org/dependabot/go_modules/github.com/unistack-org/micro/v3-3.7.3
Bump github.com/unistack-org/micro/v3 from 3.7.1 to 3.7.3
2021-09-22 11:20:42 +00:00
dependabot[bot]
10aec04f04 Bump github.com/unistack-org/micro/v3 from 3.7.1 to 3.7.3
Bumps [github.com/unistack-org/micro/v3](https://github.com/unistack-org/micro) from 3.7.1 to 3.7.3.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.7.1...v3.7.3)

---
updated-dependencies:
- dependency-name: github.com/unistack-org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-22 11:19:49 +00:00
6091098955 update workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-21 21:47:38 +03:00
37fdf5cc79 update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-17 07:49:03 +03:00
github-actions[bot]
4cc0553f96 Merge pull request #37 from unistack-org/dependabot/go_modules/github.com/VictoriaMetrics/metrics-1.18.0
Bump github.com/VictoriaMetrics/metrics from 1.17.3 to 1.18.0
2021-09-16 11:21:28 +00:00
dependabot[bot]
0966d9c171 Bump github.com/VictoriaMetrics/metrics from 1.17.3 to 1.18.0
Bumps [github.com/VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) from 1.17.3 to 1.18.0.
- [Release notes](https://github.com/VictoriaMetrics/metrics/releases)
- [Commits](https://github.com/VictoriaMetrics/metrics/compare/v1.17.3...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/VictoriaMetrics/metrics
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-16 11:20:32 +00:00
github-actions[bot]
601db8f934 Merge pull request #38 from unistack-org/dependabot/go_modules/github.com/unistack-org/micro/v3-3.7.1
Bump github.com/unistack-org/micro/v3 from 3.7.0 to 3.7.1
2021-09-16 11:18:23 +00:00
dependabot[bot]
fc0839b9e3 Bump github.com/unistack-org/micro/v3 from 3.7.0 to 3.7.1
Bumps [github.com/unistack-org/micro/v3](https://github.com/unistack-org/micro) from 3.7.0 to 3.7.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.7.0...v3.7.1)

---
updated-dependencies:
- dependency-name: github.com/unistack-org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-16 11:17:33 +00:00
83df476d0f enable automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-16 11:07:10 +03:00
dependabot[bot]
16054ce84b Bump github.com/VictoriaMetrics/metrics from 1.17.2 to 1.17.3 (#35) 2021-09-06 15:06:34 +00:00
dependabot[bot]
1846fa41ad Bump github.com/unistack-org/micro/v3 from 3.4.11 to 3.7.0 (#36) 2021-09-06 14:52:31 +00:00
5ff0349304 add github stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-06 15:20:42 +03:00
8ad091b096 add github stuff
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-06 14:45:02 +03:00
e9a657e895 fast path for labels
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-07-23 08:59:50 +03:00
6a35c083ad update wrapper for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-07-21 16:37:51 +03:00
874552803e update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-28 01:13:08 +03:00
Renovate Bot
e4b207de2a Update module github.com/unistack-org/micro/v3 to v3.3.16 2021-04-20 12:28:23 +00:00
Renovate Bot
8d07b2df97 Update module github.com/unistack-org/micro/v3 to v3.3.15 2021-04-19 14:42:27 +00:00
Renovate Bot
6a41fc290a Update module github.com/unistack-org/micro/v3 to v3.3.14 2021-04-19 02:08:32 +00:00
Renovate Bot
da3ae7f36a Update module github.com/unistack-org/micro/v3 to v3.3.13 2021-04-10 00:56:39 +00:00
Renovate Bot
6e8c62ee7c Update module github.com/unistack-org/micro/v3 to v3.3.11 2021-04-03 09:29:23 +00:00
Renovate Bot
d0903a09d9 Update module github.com/unistack-org/micro/v3 to v3.3.10 2021-04-01 01:18:49 +00:00
Renovate Bot
637056f638 Update module github.com/unistack-org/micro/v3 to v3.3.9 2021-03-30 05:16:10 +00:00
Renovate Bot
b0a35cc7bc Update module github.com/unistack-org/micro/v3 to v3.3.8 2021-03-29 00:46:07 +00:00
Renovate Bot
44f16fe156 Update module github.com/unistack-org/micro/v3 to v3.3.4 2021-03-26 18:44:55 +00:00
Renovate Bot
fd5f71f40c Update module github.com/unistack-org/micro/v3 to v3.3.2 2021-03-25 14:44:51 +00:00
Renovate Bot
63f7c406c4 Update module github.com/unistack-org/micro/v3 to v3.3.1 2021-03-25 01:23:41 +00:00
Renovate Bot
026335ade0 Update module github.com/unistack-org/micro/v3 to v3.3.0 2021-03-24 14:04:17 +00:00
Renovate Bot
4db544153a Update module github.com/unistack-org/micro/v3 to v3.2.26 2021-03-23 18:20:53 +00:00
Renovate Bot
78a83287fa Update module github.com/VictoriaMetrics/metrics to v1.17.2 2021-03-22 16:50:30 +00:00
Renovate Bot
bdf1e8c5f2 Update module github.com/unistack-org/micro/v3 to v3.2.24 2021-03-21 15:28:40 +00:00
Renovate Bot
94ae7b1b17 Update module github.com/VictoriaMetrics/metrics to v1.17.1 2021-03-18 19:05:19 +00:00
Renovate Bot
96ecdd862c Update module github.com/VictoriaMetrics/metrics to v1.17.0 2021-03-18 00:49:03 +00:00
Renovate Bot
821880743c Update module github.com/VictoriaMetrics/metrics to v1.16.0 2021-03-17 18:57:01 +00:00
Renovate Bot
790c5ec04e Update module github.com/unistack-org/micro/v3 to v3.2.23 2021-03-16 19:38:01 +00:00
Renovate Bot
851839a3ad Update module github.com/VictoriaMetrics/metrics to v1.15.3 2021-03-16 12:37:49 +00:00
23 changed files with 619 additions and 135 deletions

View File

@@ -1,6 +1,6 @@
--- ---
name: Bug report name: Bug report
about: For reporting bugs in go-micro about: For reporting bugs in micro
title: "[BUG]" title: "[BUG]"
labels: '' labels: ''
assignees: '' assignees: ''
@@ -16,9 +16,3 @@ assignees: ''
**How to reproduce the bug:** **How to reproduce the bug:**
If possible, please include a minimal code snippet here. If possible, please include a minimal code snippet here.
**Environment:**
Go Version: please paste `go version` output here
```
please paste `go env` output here
```

View File

@@ -1,6 +1,6 @@
--- ---
name: Feature request / Enhancement name: Feature request / Enhancement
about: If you have a need not served by go-micro about: If you have a need not served by micro
title: "[FEATURE]" title: "[FEATURE]"
labels: '' labels: ''
assignees: '' assignees: ''

View File

@@ -1,14 +1,8 @@
--- ---
name: Question name: Question
about: Ask a question about go-micro about: Ask a question about micro
title: '' title: ''
labels: '' labels: ''
assignees: '' assignees: ''
--- ---
Before asking, please check if your question has already been answered:
1. Check the documentation - https://micro.mu/docs/
2. Check the examples and plugins - https://github.com/micro/examples & https://github.com/micro/go-plugins
3. Search existing issues

28
.github/autoapprove.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: "autoapprove"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
workflow_run:
workflows: ["prbuild"]
types:
- completed
permissions:
pull-requests: write
contents: write
jobs:
autoapprove:
runs-on: ubuntu-latest
steps:
- name: approve
run: [ "curl -o tea https://dl.gitea.com/tea/main/tea-main-linux-amd64",
"chmod +x ./tea",
"./tea login add --name unistack --token ${{ secrets.GITHUB_TOKEN }} --url https://git.unistack.org",
"./tea pr --repo ${{ github.event.repository.name }}"
]
if: github.actor == 'vtolstov'
id: approve
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

19
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for Golang
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

20
.github/renovate.json vendored
View File

@@ -1,20 +0,0 @@
{
"extends": [
"config:base"
],
"postUpdateOptions": ["gomodTidy"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"groupName": "all deps",
"separateMajorMinor": true,
"groupSlug": "all",
"packagePatterns": [
"*"
]
}
]
}

20
.github/workflows/autoapprove.yml vendored Normal file
View 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@v2
if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]'
id: approve
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

21
.github/workflows/automerge.yml vendored Normal file
View 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}}

View File

@@ -3,6 +3,7 @@ on:
push: push:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
@@ -13,7 +14,7 @@ jobs:
with: with:
go-version: 1.16 go-version: 1.16
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@@ -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.1.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.

78
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "codeql"
on:
workflow_run:
workflows: ["prbuild"]
types:
- completed
push:
branches: [ master, v3 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, v3 ]
schedule:
- cron: '34 1 * * 0'
jobs:
analyze:
name: analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup
uses: actions/setup-go@v2
with:
go-version: 1.16
# Initializes the CodeQL tools for scanning.
- name: init
uses: github/codeql-action/init@v1
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@v1
# 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
#- run: |
# make bootstrap
# make release
- name: analyze
uses: github/codeql-action/analyze@v1

View File

@@ -0,0 +1,27 @@
name: "dependabot-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 == 'dependabot[bot]'
steps:
- name: metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.0
with:
github-token: "${{ secrets.TOKEN }}"
- name: merge
id: merge
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

53
.github/workflows/job_coverage.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: coverage
on:
push:
branches: [ main, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
pull_request:
branches: [ main, v3, v4 ]
jobs:
build:
if: github.server_url != 'https://github.com'
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
filter: 'blob:none'
- name: setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: "**/*.sum"
go-version: 'stable'
- name: test coverage
run: |
go test -v -cover ./... -covermode=count -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out
- name: coverage badge
uses: tj-actions/coverage-badge-go@v2
with:
green: 80
filename: coverage.out
- uses: stefanzweifel/git-auto-commit-action@v4
name: autocommit
with:
commit_message: Apply Code Coverage Badge
skip_fetch: false
skip_checkout: false
file_pattern: ./README.md
- name: push
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref }}

29
.github/workflows/job_lint.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: lint
on:
pull_request:
types: [opened, reopened, synchronize]
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
filter: 'blob:none'
- name: setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: "**/*.sum"
go-version: 'stable'
- name: setup deps
run: go get -v ./...
- name: run lint
uses: golangci/golangci-lint-action@v6
with:
version: 'latest'

94
.github/workflows/job_sync.yml vendored Normal file
View File

@@ -0,0 +1,94 @@
name: sync
on:
schedule:
- cron: '*/5 * * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
sync:
if: github.server_url != 'https://github.com'
runs-on: ubuntu-latest
steps:
- name: init
run: |
git config --global user.email "vtolstov <vtolstov@users.noreply.github.com>"
git config --global user.name "github-actions[bot]"
echo "machine git.unistack.org login vtolstov password ${{ secrets.TOKEN_GITEA }}" >> /root/.netrc
echo "machine github.com login vtolstov password ${{ secrets.TOKEN_GITHUB }}" >> /root/.netrc
- name: check master
id: check_master
run: |
src_hash=$(git ls-remote https://github.com/${GITHUB_REPOSITORY} refs/heads/master | cut -f1)
dst_hash=$(git ls-remote ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} refs/heads/master | cut -f1)
echo "src_hash=$src_hash"
echo "dst_hash=$dst_hash"
if [ "$src_hash" != "$dst_hash" ]; then
echo "sync_needed=true" >> $GITHUB_OUTPUT
else
echo "sync_needed=false" >> $GITHUB_OUTPUT
fi
- name: sync master
if: steps.check_master.outputs.sync_needed == 'true'
run: |
git clone --filter=blob:none --filter=tree:0 --branch master --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
cd repo
git remote add --no-tags --fetch --track master upstream https://github.com/${GITHUB_REPOSITORY}
git pull --rebase upstream master
git push upstream master --progress
git push origin master --progress
cd ../
rm -rf repo
- name: check v3
id: check_v3
run: |
src_hash=$(git ls-remote https://github.com/${GITHUB_REPOSITORY} refs/heads/v3 | cut -f1)
dst_hash=$(git ls-remote ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} refs/heads/v3 | cut -f1)
echo "src_hash=$src_hash"
echo "dst_hash=$dst_hash"
if [ "$src_hash" != "$dst_hash" ]; then
echo "sync_needed=true" >> $GITHUB_OUTPUT
else
echo "sync_needed=false" >> $GITHUB_OUTPUT
fi
- name: sync v3
if: steps.check_v3.outputs.sync_needed == 'true'
run: |
git clone --filter=blob:none --filter=tree:0 --branch v3 --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
cd repo
git remote add --no-tags --fetch --track v3 upstream https://github.com/${GITHUB_REPOSITORY}
git pull --rebase upstream v3
git push upstream v3 --progress
git push origin v3 --progress
cd ../
rm -rf repo
- name: check v4
id: check_v4
run: |
src_hash=$(git ls-remote https://github.com/${GITHUB_REPOSITORY} refs/heads/v4 | cut -f1)
dst_hash=$(git ls-remote ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} refs/heads/v4 | cut -f1)
echo "src_hash=$src_hash"
echo "dst_hash=$dst_hash"
if [ "$src_hash" != "$dst_hash" ]; then
echo "sync_needed=true" >> $GITHUB_OUTPUT
else
echo "sync_needed=false" >> $GITHUB_OUTPUT
fi
- name: sync v4
if: steps.check_v4.outputs.sync_needed == 'true'
run: |
git clone --filter=blob:none --filter=tree:0 --branch v4 --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
cd repo
git remote add --no-tags --fetch --track v4 upstream https://github.com/${GITHUB_REPOSITORY}
git pull --rebase upstream v4
git push upstream v4 --progress
git push origin v4 --progress
cd ../
rm -rf repo

31
.github/workflows/job_test.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: test
on:
pull_request:
types: [opened, reopened, synchronize]
branches: [ master, v3, v4 ]
push:
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
filter: 'blob:none'
- name: setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: "**/*.sum"
go-version: 'stable'
- name: setup deps
run: go get -v ./...
- name: run test
env:
INTEGRATION_TESTS: yes
run: go test -mod readonly -v ./...

50
.github/workflows/job_tests.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: test
on:
pull_request:
types: [opened, reopened, synchronize]
branches: [ master, v3, v4 ]
push:
branches: [ master, v3, v4 ]
paths-ignore:
- '.github/**'
- '.gitea/**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
filter: 'blob:none'
- name: checkout tests
uses: actions/checkout@v4
with:
ref: master
filter: 'blob:none'
repository: unistack-org/micro-tests
path: micro-tests
- name: setup go
uses: actions/setup-go@v5
with:
cache-dependency-path: "**/*.sum"
go-version: 'stable'
- name: setup go work
env:
GOWORK: ${{ github.workspace }}/go.work
run: |
go work init
go work use .
go work use micro-tests
- name: setup deps
env:
GOWORK: ${{ github.workspace }}/go.work
run: go get -v ./...
- name: run tests
env:
INTEGRATION_TESTS: yes
GOWORK: ${{ github.workspace }}/go.work
run: |
cd micro-tests
go test -mod readonly -v ./... || true

View File

@@ -3,6 +3,7 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
@@ -13,7 +14,7 @@ jobs:
with: with:
go-version: 1.16 go-version: 1.16
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@@ -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.1.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.

5
.golangci.yml Normal file
View File

@@ -0,0 +1,5 @@
run:
concurrency: 8
timeout: 5m
issues-exit-code: 1
tests: true

View File

@@ -1,4 +1,5 @@
# VictoriaMetrics # VictoriaMetrics
![Coverage](https://img.shields.io/badge/Coverage-50.0%25-yellow)
Wrappers are a form of middleware that can be used with go-micro services. They can wrap both the Client and Server handlers. Wrappers are a form of middleware that can be used with go-micro services. They can wrap both the Client and Server handlers.
This plugin implements the HandlerWrapper interface to provide automatic prometheus metric handling This plugin implements the HandlerWrapper interface to provide automatic prometheus metric handling

23
go.mod
View File

@@ -1,8 +1,23 @@
module github.com/unistack-org/micro-meter-victoriametrics/v3 module go.unistack.org/micro-meter-victoriametrics/v4
go 1.16 go 1.23.0
toolchain go1.24.4
require ( require (
github.com/VictoriaMetrics/metrics v1.15.2 github.com/VictoriaMetrics/metrics v1.38.0
github.com/unistack-org/micro/v3 v3.2.22 go.unistack.org/micro/v4 v4.1.18
)
require (
github.com/google/uuid v1.6.0 // indirect
github.com/matoous/go-nanoid v1.5.1 // indirect
github.com/spf13/cast v1.8.0 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
github.com/valyala/histogram v1.2.0 // indirect
go.unistack.org/micro-proto/v4 v4.1.0 // indirect
golang.org/x/sys v0.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/grpc v1.72.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
) )

71
go.sum
View File

@@ -1,23 +1,48 @@
github.com/VictoriaMetrics/metrics v1.15.2 h1:w/GD8L9tm+gvx1oZvAofRRXwammiicdI0jgLghA2Gdo= github.com/VictoriaMetrics/metrics v1.38.0 h1:1d0dRgVH8Nnu8dKMfisKefPC3q7gqf3/odyO0quAvyA=
github.com/VictoriaMetrics/metrics v1.15.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= github.com/VictoriaMetrics/metrics v1.38.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/unistack-org/micro/v3 v3.2.22 h1:AXyLtRpfcPGczhaA1f9KR0ctK+1Zpqvb+rBJrZtp3Oo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/unistack-org/micro/v3 v3.2.22/go.mod h1:oI8H/uGq1h4i5cvUycEoFKJQC7G8yChZQNIDNWGSLRU= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/valyala/histogram v1.1.2 h1:vOk5VrGjMBIoPR5k6wA8vBaC8toeJ8XO0yfRjFEc1h8= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/valyala/histogram v1.1.2/go.mod h1:CZAr6gK9dbD7hYx2s8WSPh0p5x5wETjC+2b3PJVtEdg= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= github.com/matoous/go-nanoid v1.5.1 h1:aCjdvTyO9LLnTIi0fgdXhOPPvOHjpXN6Ik9DaNjIct4=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= github.com/matoous/go-nanoid v1.5.1/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk=
github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
go.unistack.org/micro-proto/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9lKUk=
go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
go.unistack.org/micro/v4 v4.1.18 h1:e19D40069N9AzIZJrX/f9bT8HfntL/GnYggEmDxXKN4=
go.unistack.org/micro/v4 v4.1.18/go.mod h1:xleO2M5Yxh4s6I+RUcLrEpUjobefh+71ctrdIfn7TUs=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ=
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -2,89 +2,88 @@ package victoriametrics
import ( import (
"io" "io"
"strings"
"time" "time"
"github.com/VictoriaMetrics/metrics" "github.com/VictoriaMetrics/metrics"
"github.com/unistack-org/micro/v3/meter" "go.unistack.org/micro/v4/meter"
) )
type victoriametricsMeter struct { type victoriametricsMeter struct {
set *metrics.Set set *metrics.Set
opts meter.Options opts meter.Options
prometheusCompat bool
} }
func NewMeter(opts ...meter.Option) meter.Meter { func NewMeter(opts ...meter.Option) meter.Meter {
return &victoriametricsMeter{set: metrics.NewSet(), opts: meter.NewOptions(opts...)} m := &victoriametricsMeter{set: metrics.NewSet(), opts: meter.NewOptions(opts...)}
if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v {
m.prometheusCompat = v
}
return m
} }
func (r *victoriametricsMeter) Name() string { func (r *victoriametricsMeter) Name() string {
return r.opts.Name return r.opts.Name
} }
func (r *victoriametricsMeter) buildName(name string, opts ...meter.Option) string { func (r *victoriametricsMeter) Clone(opts ...meter.Option) meter.Meter {
var b strings.Builder
options := r.opts options := r.opts
for _, o := range opts { for _, o := range opts {
o(&options) o(&options)
} }
m := &victoriametricsMeter{set: r.set, opts: options}
if len(options.MetricPrefix) > 0 { if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v {
_, _ = b.WriteString(options.MetricPrefix) m.prometheusCompat = v
} }
labelPrefix := false return m
if len(options.LabelPrefix) > 0 {
labelPrefix = true
}
_, _ = b.WriteString(name)
if len(options.Labels) > 0 {
meter.Sort(&options.Labels)
_, _ = b.WriteRune('{')
for idx := 0; idx < len(options.Labels); idx += 2 {
if idx > 0 {
_, _ = b.WriteRune(',')
}
if labelPrefix {
_, _ = b.WriteString(options.LabelPrefix)
}
_, _ = b.WriteString(options.Labels[idx])
_, _ = b.WriteString(`="`)
_, _ = b.WriteString(options.Labels[idx+1])
_, _ = b.WriteString(`"`)
}
_, _ = b.WriteRune('}')
}
return b.String()
} }
func (r *victoriametricsMeter) Counter(name string, opts ...meter.Option) meter.Counter { func (r *victoriametricsMeter) buildName(name string, labels ...string) string {
return r.set.GetOrCreateCounter(r.buildName(name, opts...)) nl := len(r.opts.Labels) + len(labels)
if nl == 0 {
return name
}
nlabels := make([]string, 0, nl)
nlabels = append(nlabels, r.opts.Labels...)
nlabels = append(nlabels, labels...)
return meter.BuildName(name, nlabels...)
} }
func (r *victoriametricsMeter) FloatCounter(name string, opts ...meter.Option) meter.FloatCounter { func (r *victoriametricsMeter) Counter(name string, labels ...string) meter.Counter {
return r.set.GetOrCreateFloatCounter(r.buildName(name, opts...)) return r.set.GetOrCreateCounter(r.buildName(name, labels...))
} }
func (r *victoriametricsMeter) Gauge(name string, f func() float64, opts ...meter.Option) meter.Gauge { func (r *victoriametricsMeter) FloatCounter(name string, labels ...string) meter.FloatCounter {
return r.set.GetOrCreateGauge(r.buildName(name, opts...), f) return r.set.GetOrCreateFloatCounter(r.buildName(name, labels...))
} }
func (r *victoriametricsMeter) Histogram(name string, opts ...meter.Option) meter.Histogram { func (r *victoriametricsMeter) Gauge(name string, f func() float64, labels ...string) meter.Gauge {
return r.set.GetOrCreateHistogram(r.buildName(name, opts...)) return r.set.GetOrCreateGauge(r.buildName(name, labels...), f)
} }
func (r *victoriametricsMeter) Summary(name string, opts ...meter.Option) meter.Summary { func (r *victoriametricsMeter) Histogram(name string, labels ...string) meter.Histogram {
return r.set.GetOrCreateSummary(r.buildName(name, opts...)) if r.prometheusCompat {
return r.set.GetOrCreatePrometheusHistogram(r.buildName(name, labels...))
}
return r.set.GetOrCreateHistogram(r.buildName(name, labels...))
} }
func (r *victoriametricsMeter) SummaryExt(name string, window time.Duration, quantiles []float64, opts ...meter.Option) meter.Summary { func (r *victoriametricsMeter) Summary(name string, labels ...string) meter.Summary {
return r.set.GetOrCreateSummaryExt(r.buildName(name, opts...), window, quantiles) return r.set.GetOrCreateSummary(r.buildName(name, labels...))
}
func (r *victoriametricsMeter) SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) meter.Summary {
return r.set.GetOrCreateSummaryExt(r.buildName(name, labels...), window, quantiles)
} }
func (r *victoriametricsMeter) Set(opts ...meter.Option) meter.Meter { func (r *victoriametricsMeter) Set(opts ...meter.Option) meter.Meter {
m := &victoriametricsMeter{opts: meter.NewOptions(opts...), set: metrics.NewSet()} m := &victoriametricsMeter{opts: r.opts, prometheusCompat: r.prometheusCompat}
for _, o := range opts {
o(&m.opts)
}
m.set = metrics.NewSet()
return m return m
} }
@@ -92,7 +91,9 @@ func (r *victoriametricsMeter) Init(opts ...meter.Option) error {
for _, o := range opts { for _, o := range opts {
o(&r.opts) o(&r.opts)
} }
if v, ok := r.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v {
r.prometheusCompat = v
}
return nil return nil
} }
@@ -119,3 +120,9 @@ func (r *victoriametricsMeter) Options() meter.Options {
func (r *victoriametricsMeter) String() string { func (r *victoriametricsMeter) String() string {
return "victoriametrics" return "victoriametrics"
} }
type prometheusCompatKey struct{}
func PrometheusCompat(b bool) meter.Option {
return meter.SetOption(prometheusCompatKey{}, b)
}

View File

@@ -1,42 +1,49 @@
package victoriametrics package victoriametrics
import ( import (
"bytes"
"context" "context"
"testing" "testing"
"github.com/unistack-org/micro/v3/client" "go.unistack.org/micro/v4/client"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v4/codec"
"github.com/unistack-org/micro/v3/meter" "go.unistack.org/micro/v4/meter"
"github.com/unistack-org/micro/v3/meter/wrapper"
) )
func BenchmarkBuildName(b *testing.B) {
m := NewMeter(meter.Labels("pod", "xxx"))
if err := m.Init(); err != nil {
b.Fatal(err)
}
im := m.(*victoriametricsMeter)
b.ResetTimer()
for i := 0; i < b.N; i++ {
name := im.buildName("micro_foo", "bar", "baz", "aaa", "b", "ccc", "d")
_ = name
}
}
func TestBuildName(t *testing.T) { func TestBuildName(t *testing.T) {
m := NewMeter() m := NewMeter()
im := m.(*victoriametricsMeter) im := m.(*victoriametricsMeter)
check := `micro_foo{micro_aaa="b",micro_bar="baz"}` check := `micro_foo{bar="baz",aaa="b",ccc="d"}`
name := im.buildName("foo", meter.Labels("bar", "baz", "aaa", "b")) name := im.buildName("micro_foo", "bar", "baz", "aaa", "b", "ccc", "d")
if name != check { if name != check {
t.Fatalf("metric name error: %s != %s", name, check) t.Fatalf("metric name error: %s != %s", name, check)
} }
cnt := m.Counter("counter", meter.Labels("key", "val")) cnt := m.Counter("counter", "key", "val")
cnt.Inc() cnt.Inc()
//m.Write(os.Stdout, meter.WriteProcessMetrics(true), meter.WriteFDMetrics(true))
} }
func TestWrapper(t *testing.T) { func TestWrapper(t *testing.T) {
m := NewMeter() m := NewMeter()
if err := m.Init(); err != nil {
w := wrapper.NewClientWrapper( t.Fatal(err)
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)
} }
@@ -44,5 +51,9 @@ func TestWrapper(t *testing.T) {
req := &codec.Frame{} req := &codec.Frame{}
err := c.Call(ctx, c.NewRequest("svc2", "Service.Method", req), rsp) err := c.Call(ctx, c.NewRequest("svc2", "Service.Method", req), rsp)
_, _ = rsp, err _, _ = rsp, err
//m.Write(os.Stdout, meter.WriteProcessMetrics(true), meter.WriteFDMetrics(true)) buf := bytes.NewBuffer(nil)
_ = m.Write(buf, meter.WriteProcessMetrics(false), meter.WriteFDMetrics(false))
if !bytes.Contains(buf.Bytes(), []byte(`micro_client_request_total{endpoint="Service.Method",status="failure",code="500"} 1`)) {
t.Fatalf("invalid metrics output: %s", buf.Bytes())
}
} }