Compare commits
	
		
			81 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| dbcf52e590 | |||
| 4fef299e78 | |||
| a239f86139 | |||
| c187502cd4 | |||
| 
						 | 
					0fcf592e87 | ||
| 74bab50879 | |||
| 
						 | 
					8375fd2535 | ||
| 1381db40c6 | |||
| 
						 | 
					7515f2bd9e | ||
| 5cf43ba9e3 | |||
| 
						 | 
					d9a02c1ce1 | ||
| 5bae6e6b24 | |||
| 
						 | 
					c5e6653380 | ||
| 8befdae5bc | |||
| 
						 | 
					6a348a2f9d | ||
| 7f0bf98b2e | |||
| 
						 | 
					edaa545ed4 | ||
| 7ac92a2249 | |||
| 
						 | 
					4d49c925ef | ||
| f6b8a429f9 | |||
| 
						 | 
					75f20a4962 | ||
| 3ff4f40026 | |||
| 
						 | 
					362e857414 | ||
| 
						 | 
					ab384564a6 | ||
| 
						 | 
					5119c8b6a3 | ||
| 
						 | 
					ebe50db0b8 | ||
| 3e88c33191 | |||
| 
						 | 
					6f1fa39dcf | ||
| 95b846e975 | |||
| 
						 | 
					8d6506ee70 | ||
| 6b5a3194ca | |||
| 
						 | 
					61609271ee | ||
| d4c0be717e | |||
| 
						 | 
					d64e293877 | ||
| b5d9880a8e | |||
| 
						 | 
					f63108ea1a | ||
| 
						 | 
					7531140dcd | ||
| de97bc0d7b | |||
| 
						 | 
					dd3c2316e0 | ||
| 1c5a85b88a | |||
| 
						 | 
					5ab95f3f31 | ||
| 
						 | 
					d2411e9b79 | ||
| 931fa9796b | |||
| 
						 | 
					03b30c5c19 | ||
| 607727c907 | |||
| 
						 | 
					228a57e4d8 | ||
| 
						 | 
					d83f4fb061 | ||
| 873bfb10b0 | |||
| 7bd47f03d7 | |||
| 
						 | 
					54a7f8baa4 | ||
| 
						 | 
					10c9806ebd | ||
| 
						 | 
					bedec603a9 | ||
| 
						 | 
					6c837b6529 | ||
| 
						 | 
					15bc60fedc | ||
| 098152f58f | |||
| 
						 | 
					0499cb0b05 | ||
| c4eda1c57b | |||
| 
						 | 
					d6cdb67d8b | ||
| 
						 | 
					720dab8885 | ||
| 2413f4bad1 | |||
| 
						 | 
					d11c5676c8 | ||
| 
						 | 
					d6b9bdef99 | ||
| 
						 | 
					8717a4973a | ||
| 95a1db0b5b | |||
| 
						 | 
					57c161cfaf | ||
| 0db942cfe2 | |||
| 
						 | 
					47201a9dea | ||
| 53d518fa17 | |||
| 
						 | 
					5354556d17 | ||
| bfd5ac8311 | |||
| 
						 | 
					b23bb2d51b | ||
| 7414ed2587 | |||
| 
						 | 
					a6500aa9ea | ||
| a8dec8755f | |||
| 
						 | 
					ee3b5f115e | ||
| b9ab04552f | |||
| e73c14e217 | |||
| 
						 | 
					5131af242a | ||
| fa64ec858c | |||
| 
						 | 
					1710561d6a | ||
| 4e7a852b8b | 
							
								
								
									
										19
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
										Normal 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/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}}
 | 
				
			||||||
							
								
								
									
										47
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					name: build
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					 push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					    - master
 | 
				
			||||||
 | 
					    - v3
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  test:
 | 
				
			||||||
 | 
					    name: test
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - name: setup
 | 
				
			||||||
 | 
					      uses: actions/setup-go@v3
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        go-version: 1.17
 | 
				
			||||||
 | 
					    - name: checkout
 | 
				
			||||||
 | 
					      uses: actions/checkout@v3
 | 
				
			||||||
 | 
					    - name: cache
 | 
				
			||||||
 | 
					      uses: actions/cache@v3
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        path: ~/go/pkg/mod
 | 
				
			||||||
 | 
					        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
 | 
				
			||||||
 | 
					        restore-keys: ${{ runner.os }}-go-
 | 
				
			||||||
 | 
					    - name: deps
 | 
				
			||||||
 | 
					      run: go get -v -t -d ./...
 | 
				
			||||||
 | 
					    - name: test
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        INTEGRATION_TESTS: yes
 | 
				
			||||||
 | 
					      run: go test -mod readonly -v ./...
 | 
				
			||||||
 | 
					  lint:
 | 
				
			||||||
 | 
					    name: lint
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - name: checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
 | 
					      - name: lint
 | 
				
			||||||
 | 
					        uses: golangci/golangci-lint-action@v3.4.0
 | 
				
			||||||
 | 
					        continue-on-error: true
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
 | 
				
			||||||
 | 
					          version: v1.30
 | 
				
			||||||
 | 
					          # Optional: working directory, useful for monorepos
 | 
				
			||||||
 | 
					          # working-directory: somedir
 | 
				
			||||||
 | 
					          # Optional: golangci-lint command line arguments.
 | 
				
			||||||
 | 
					          # args: --issues-exit-code=0
 | 
				
			||||||
 | 
					          # Optional: show only new issues if it's a pull request. The default value is `false`.
 | 
				
			||||||
 | 
					          # only-new-issues: true
 | 
				
			||||||
							
								
								
									
										78
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
										Normal 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@v3
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        go-version: 1.17
 | 
				
			||||||
 | 
					    # Initializes the CodeQL tools for scanning.
 | 
				
			||||||
 | 
					    - name: init
 | 
				
			||||||
 | 
					      uses: github/codeql-action/init@v2
 | 
				
			||||||
 | 
					      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@v2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # ℹ️ 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@v2
 | 
				
			||||||
							
								
								
									
										27
									
								
								.github/workflows/dependabot-automerge.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/dependabot-automerge.yml
									
									
									
									
										vendored
									
									
										Normal 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.6
 | 
				
			||||||
 | 
					        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
									
									
								
							
							
						
						
									
										53
									
								
								.github/workflows/job_coverage.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,53 +0,0 @@
 | 
				
			|||||||
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@v3
 | 
					 | 
				
			||||||
      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
									
									
								
							
							
						
						
									
										29
									
								
								.github/workflows/job_lint.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,29 +0,0 @@
 | 
				
			|||||||
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
									
									
								
							
							
						
						
									
										94
									
								
								.github/workflows/job_sync.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,94 +0,0 @@
 | 
				
			|||||||
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
									
									
								
							
							
						
						
									
										31
									
								
								.github/workflows/job_test.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,31 +0,0 @@
 | 
				
			|||||||
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
									
									
								
							
							
						
						
									
										50
									
								
								.github/workflows/job_tests.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,50 +0,0 @@
 | 
				
			|||||||
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
 | 
					 | 
				
			||||||
							
								
								
									
										47
									
								
								.github/workflows/pr.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								.github/workflows/pr.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					name: prbuild
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					    - master
 | 
				
			||||||
 | 
					    - v3
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  test:
 | 
				
			||||||
 | 
					    name: test
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - name: setup
 | 
				
			||||||
 | 
					      uses: actions/setup-go@v3
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        go-version: 1.17
 | 
				
			||||||
 | 
					    - name: checkout
 | 
				
			||||||
 | 
					      uses: actions/checkout@v3
 | 
				
			||||||
 | 
					    - name: cache
 | 
				
			||||||
 | 
					      uses: actions/cache@v3
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        path: ~/go/pkg/mod
 | 
				
			||||||
 | 
					        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
 | 
				
			||||||
 | 
					        restore-keys: ${{ runner.os }}-go-
 | 
				
			||||||
 | 
					    - name: deps
 | 
				
			||||||
 | 
					      run: go get -v -t -d ./...
 | 
				
			||||||
 | 
					    - name: test
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        INTEGRATION_TESTS: yes
 | 
				
			||||||
 | 
					      run: go test -mod readonly -v ./...
 | 
				
			||||||
 | 
					  lint:
 | 
				
			||||||
 | 
					    name: lint
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - name: checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
 | 
					      - name: lint
 | 
				
			||||||
 | 
					        uses: golangci/golangci-lint-action@v3.4.0
 | 
				
			||||||
 | 
					        continue-on-error: true
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
 | 
				
			||||||
 | 
					          version: v1.30
 | 
				
			||||||
 | 
					          # Optional: working directory, useful for monorepos
 | 
				
			||||||
 | 
					          # working-directory: somedir
 | 
				
			||||||
 | 
					          # Optional: golangci-lint command line arguments.
 | 
				
			||||||
 | 
					          # args: --issues-exit-code=0
 | 
				
			||||||
 | 
					          # Optional: show only new issues if it's a pull request. The default value is `false`.
 | 
				
			||||||
 | 
					          # only-new-issues: true
 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
run:
 | 
					 | 
				
			||||||
  concurrency: 8
 | 
					 | 
				
			||||||
  timeout: 5m
 | 
					 | 
				
			||||||
  issues-exit-code: 1
 | 
					 | 
				
			||||||
  tests: true
 | 
					 | 
				
			||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
# VictoriaMetrics
 | 
					# VictoriaMetrics
 | 
				
			||||||

 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								go.mod
									
									
									
									
									
								
							@@ -1,23 +1,16 @@
 | 
				
			|||||||
module go.unistack.org/micro-meter-victoriametrics/v4
 | 
					module go.unistack.org/micro-meter-victoriametrics/v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
go 1.24.0
 | 
					go 1.22
 | 
				
			||||||
 | 
					
 | 
				
			||||||
toolchain go1.24.4
 | 
					toolchain go1.23.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/VictoriaMetrics/metrics v1.40.2
 | 
						go.unistack.org/metrics v0.0.1
 | 
				
			||||||
	go.unistack.org/micro/v4 v4.1.23
 | 
						go.unistack.org/micro/v3 v3.10.100
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					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/fastrand v1.1.0 // indirect
 | 
				
			||||||
	github.com/valyala/histogram v1.2.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.27.0 // indirect
 | 
				
			||||||
	golang.org/x/sys v0.37.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
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										50
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								go.sum
									
									
									
									
									
								
							@@ -1,48 +1,10 @@
 | 
				
			|||||||
github.com/VictoriaMetrics/metrics v1.40.2 h1:OVSjKcQEx6JAwGeu8/KQm9Su5qJ72TMEW4xYn5vw3Ac=
 | 
					 | 
				
			||||||
github.com/VictoriaMetrics/metrics v1.40.2/go.mod h1:XE4uudAAIRaJE614Tl5HMrtoEU6+GDZO4QTnNSsZRuA=
 | 
					 | 
				
			||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
 | 
					 | 
				
			||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
					 | 
				
			||||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
 | 
					 | 
				
			||||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
 | 
					 | 
				
			||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
 | 
					 | 
				
			||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
 | 
					 | 
				
			||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
 | 
					 | 
				
			||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
 | 
					 | 
				
			||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
 | 
					 | 
				
			||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 | 
					 | 
				
			||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
 | 
					 | 
				
			||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
 | 
					 | 
				
			||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 | 
					 | 
				
			||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 | 
					 | 
				
			||||||
github.com/matoous/go-nanoid v1.5.1 h1:aCjdvTyO9LLnTIi0fgdXhOPPvOHjpXN6Ik9DaNjIct4=
 | 
					 | 
				
			||||||
github.com/matoous/go-nanoid v1.5.1/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U=
 | 
					 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
 | 
					 | 
				
			||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 | 
					 | 
				
			||||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
 | 
					 | 
				
			||||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
 | 
					 | 
				
			||||||
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 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=
 | 
				
			||||||
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
 | 
					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 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
 | 
				
			||||||
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
 | 
					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/metrics v0.0.1 h1:sCnGO059ZccGC/D34iRH121eSk+7ci5+OY9cl5K7GKY=
 | 
				
			||||||
go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
 | 
					go.unistack.org/metrics v0.0.1/go.mod h1:1FY4R7EKJa9Oz2D6wlGScNerpl6igRs9Cx/3et4Rgs4=
 | 
				
			||||||
go.unistack.org/micro/v4 v4.1.23 h1:T9O1O1mN60JHqIAIw+XkNik8xb0h90O9fJ55uQMb8VU=
 | 
					go.unistack.org/micro/v3 v3.10.100 h1:yWOaU0ImCGm5k5MUzlIobJUOr+KLfrR/BoDZvcHyKxM=
 | 
				
			||||||
go.unistack.org/micro/v4 v4.1.23/go.mod h1:nlBXTbx0rQrSZX4HPp2m57PHmpuGPWUd0O+jpUIiPto=
 | 
					go.unistack.org/micro/v3 v3.10.100/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g=
 | 
				
			||||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
 | 
					golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
 | 
				
			||||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
 | 
					golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
				
			||||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
 | 
					 | 
				
			||||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
 | 
					 | 
				
			||||||
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=
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,8 +4,8 @@ import (
 | 
				
			|||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/VictoriaMetrics/metrics"
 | 
						"go.unistack.org/metrics"
 | 
				
			||||||
	"go.unistack.org/micro/v4/meter"
 | 
						"go.unistack.org/micro/v3/meter"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type victoriametricsMeter struct {
 | 
					type victoriametricsMeter struct {
 | 
				
			||||||
@@ -14,129 +14,119 @@ type victoriametricsMeter struct {
 | 
				
			|||||||
	prometheusCompat bool
 | 
						prometheusCompat bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type prometheusCompatKey struct{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func PrometheusCompat(b bool) meter.Option {
 | 
				
			||||||
 | 
						return meter.SetOption(prometheusCompatKey{}, b)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewMeter(opts ...meter.Option) meter.Meter {
 | 
					func NewMeter(opts ...meter.Option) meter.Meter {
 | 
				
			||||||
	m := &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 {
 | 
						if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok {
 | 
				
			||||||
		m.prometheusCompat = v
 | 
							m.prometheusCompat = v
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return m
 | 
						return m
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Name() string {
 | 
					func (m *victoriametricsMeter) Name() string {
 | 
				
			||||||
	return r.opts.Name
 | 
						return m.opts.Name
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Unregister(name string, labels ...string) bool {
 | 
					func (m *victoriametricsMeter) Clone(opts ...meter.Option) meter.Meter {
 | 
				
			||||||
	return r.set.UnregisterMetric(r.buildName(name, labels...))
 | 
						options := m.opts
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (r *victoriametricsMeter) Clone(opts ...meter.Option) meter.Meter {
 | 
					 | 
				
			||||||
	options := r.opts
 | 
					 | 
				
			||||||
	for _, o := range opts {
 | 
						for _, o := range opts {
 | 
				
			||||||
		o(&options)
 | 
							o(&options)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	m := &victoriametricsMeter{set: r.set, opts: options}
 | 
						nm := &victoriametricsMeter{set: m.set, opts: options, prometheusCompat: m.prometheusCompat}
 | 
				
			||||||
	if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v {
 | 
						if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok {
 | 
				
			||||||
		m.prometheusCompat = v
 | 
							m.prometheusCompat = v
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return m
 | 
						return nm
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) buildName(name string, labels ...string) string {
 | 
					func (m *victoriametricsMeter) buildName(name string, labels ...string) string {
 | 
				
			||||||
	nl := len(r.opts.Labels) + len(labels)
 | 
						nl := len(m.opts.Labels) + len(labels)
 | 
				
			||||||
	if nl == 0 {
 | 
						if nl == 0 {
 | 
				
			||||||
		return name
 | 
							return name
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nlabels := make([]string, 0, nl)
 | 
						nlabels := make([]string, 0, nl)
 | 
				
			||||||
	nlabels = append(nlabels, r.opts.Labels...)
 | 
						nlabels = append(nlabels, m.opts.Labels...)
 | 
				
			||||||
	nlabels = append(nlabels, labels...)
 | 
						nlabels = append(nlabels, labels...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return meter.BuildName(name, nlabels...)
 | 
						return meter.BuildName(name, nlabels...)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Counter(name string, labels ...string) meter.Counter {
 | 
					func (m *victoriametricsMeter) Counter(name string, labels ...string) meter.Counter {
 | 
				
			||||||
	return r.set.GetOrCreateCounter(r.buildName(name, labels...))
 | 
						return m.set.GetOrCreateCounter(m.buildName(name, labels...))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) FloatCounter(name string, labels ...string) meter.FloatCounter {
 | 
					func (m *victoriametricsMeter) FloatCounter(name string, labels ...string) meter.FloatCounter {
 | 
				
			||||||
	return r.set.GetOrCreateFloatCounter(r.buildName(name, labels...))
 | 
						return m.set.GetOrCreateFloatCounter(m.buildName(name, labels...))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Gauge(name string, f func() float64, labels ...string) meter.Gauge {
 | 
					func (m *victoriametricsMeter) Gauge(name string, f func() float64, labels ...string) meter.Gauge {
 | 
				
			||||||
	return r.set.GetOrCreateGauge(r.buildName(name, labels...), f)
 | 
						return m.set.GetOrCreateGauge(m.buildName(name, labels...), f)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Histogram(name string, labels ...string) meter.Histogram {
 | 
					func (m *victoriametricsMeter) Histogram(name string, labels ...string) meter.Histogram {
 | 
				
			||||||
	if r.prometheusCompat {
 | 
						if m.prometheusCompat {
 | 
				
			||||||
		return r.set.GetOrCreatePrometheusHistogramExt(r.buildName(name, labels...), r.opts.Quantiles)
 | 
							return m.set.GetOrCreateCompatibleHistogram(m.buildName(name, labels...))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return r.set.GetOrCreateHistogram(r.buildName(name, labels...))
 | 
						return m.set.GetOrCreateHistogram(m.buildName(name, labels...))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) HistogramExt(name string, quantiles []float64, labels ...string) meter.Histogram {
 | 
					func (m *victoriametricsMeter) Summary(name string, labels ...string) meter.Summary {
 | 
				
			||||||
	if r.prometheusCompat {
 | 
						return m.set.GetOrCreateSummary(m.buildName(name, labels...))
 | 
				
			||||||
		return r.set.GetOrCreatePrometheusHistogramExt(r.buildName(name, labels...), quantiles)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return r.set.GetOrCreateHistogram(r.buildName(name, labels...))
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Summary(name string, labels ...string) meter.Summary {
 | 
					func (m *victoriametricsMeter) SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) meter.Summary {
 | 
				
			||||||
	return r.set.GetOrCreateSummary(r.buildName(name, labels...))
 | 
						return m.set.GetOrCreateSummaryExt(m.buildName(name, labels...), window, quantiles)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) SummaryExt(name string, window time.Duration, quantiles []float64, labels ...string) meter.Summary {
 | 
					func (m *victoriametricsMeter) Set(opts ...meter.Option) meter.Meter {
 | 
				
			||||||
	return r.set.GetOrCreateSummaryExt(r.buildName(name, labels...), window, quantiles)
 | 
						nm := &victoriametricsMeter{opts: m.opts}
 | 
				
			||||||
 | 
						for _, o := range opts {
 | 
				
			||||||
 | 
							o(&nm.opts)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						nm.set = metrics.NewSet()
 | 
				
			||||||
 | 
						if v, ok := nm.opts.Context.Value(prometheusCompatKey{}).(bool); ok {
 | 
				
			||||||
 | 
							nm.prometheusCompat = v
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nm
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Set(opts ...meter.Option) meter.Meter {
 | 
					func (m *victoriametricsMeter) Init(opts ...meter.Option) error {
 | 
				
			||||||
	m := &victoriametricsMeter{opts: r.opts, prometheusCompat: r.prometheusCompat}
 | 
					 | 
				
			||||||
	for _, o := range opts {
 | 
						for _, o := range opts {
 | 
				
			||||||
		o(&m.opts)
 | 
							o(&m.opts)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	m.set = metrics.NewSet()
 | 
						if v, ok := m.opts.Context.Value(prometheusCompatKey{}).(bool); ok {
 | 
				
			||||||
	return m
 | 
							m.prometheusCompat = v
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (r *victoriametricsMeter) Init(opts ...meter.Option) error {
 | 
					 | 
				
			||||||
	for _, o := range opts {
 | 
					 | 
				
			||||||
		o(&r.opts)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if v, ok := r.opts.Context.Value(prometheusCompatKey{}).(bool); ok && v {
 | 
					 | 
				
			||||||
		r.prometheusCompat = v
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if r.opts.Quantiles == nil {
 | 
					 | 
				
			||||||
		r.opts.Quantiles = meter.DefaultQuantiles
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Write(w io.Writer, opts ...meter.Option) error {
 | 
					func (m *victoriametricsMeter) Write(w io.Writer, opts ...meter.Option) error {
 | 
				
			||||||
	options := r.opts
 | 
						options := m.opts
 | 
				
			||||||
	for _, o := range opts {
 | 
						for _, o := range opts {
 | 
				
			||||||
		o(&options)
 | 
							o(&options)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r.set.WritePrometheus(w)
 | 
						m.set.WritePrometheus(w)
 | 
				
			||||||
	if options.WriteProcessMetrics {
 | 
						if options.WriteProcessMetrics {
 | 
				
			||||||
		metrics.WriteProcessMetrics(w)
 | 
							metrics.WriteProcessMetrics(w)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if options.WriteFDMetrics {
 | 
						if options.WriteFDMetrics {
 | 
				
			||||||
		metrics.WriteFDMetrics(w)
 | 
							metrics.WriteFDMetrics(w)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) Options() meter.Options {
 | 
					func (m *victoriametricsMeter) Options() meter.Options {
 | 
				
			||||||
	return r.opts
 | 
						return m.opts
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (r *victoriametricsMeter) String() string {
 | 
					func (m *victoriametricsMeter) String() string {
 | 
				
			||||||
	return "victoriametrics"
 | 
						return "victoriametrics"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
type prometheusCompatKey struct{}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func PrometheusCompat(b bool) meter.Option {
 | 
					 | 
				
			||||||
	return meter.SetOption(prometheusCompatKey{}, b)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,32 +2,14 @@ package victoriametrics
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"bytes"
 | 
						"bytes"
 | 
				
			||||||
	"context"
 | 
					 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	"go.unistack.org/micro/v4/client"
 | 
					 | 
				
			||||||
	"go.unistack.org/micro/v4/codec"
 | 
					 | 
				
			||||||
	"go.unistack.org/micro/v4/meter"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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{bar="baz",aaa="b",ccc="d"}`
 | 
						check := `micro_foo{micro_aaa="b",micro_bar="baz",micro_ccc="d"}`
 | 
				
			||||||
	name := im.buildName("micro_foo", "bar", "baz", "aaa", "b", "ccc", "d")
 | 
						name := im.buildName("micro_foo", "micro_bar", "baz", "micro_aaa", "b", "micro_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)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -36,24 +18,12 @@ func TestBuildName(t *testing.T) {
 | 
				
			|||||||
	cnt.Inc()
 | 
						cnt.Inc()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestWrapper(t *testing.T) {
 | 
					func TestPrometheusCompat(t *testing.T) {
 | 
				
			||||||
	m := NewMeter()
 | 
						m := NewMeter(PrometheusCompat(true))
 | 
				
			||||||
	if err := m.Init(); err != nil {
 | 
						m.Histogram("foo", "key", "val").Update(15)
 | 
				
			||||||
		t.Fatal(err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ctx := context.Background()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c := client.NewClient(client.Meter(m))
 | 
					 | 
				
			||||||
	if err := c.Init(); err != nil {
 | 
					 | 
				
			||||||
		t.Fatal(err)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	rsp := &codec.Frame{}
 | 
					 | 
				
			||||||
	req := &codec.Frame{}
 | 
					 | 
				
			||||||
	err := c.Call(ctx, c.NewRequest("svc2", "Service.Method", req), rsp)
 | 
					 | 
				
			||||||
	_, _ = rsp, err
 | 
					 | 
				
			||||||
	buf := bytes.NewBuffer(nil)
 | 
						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`)) {
 | 
						_ = m.Write(buf)
 | 
				
			||||||
		t.Fatalf("invalid metrics output: %s", buf.Bytes())
 | 
						t.Logf("\n%s", buf.Bytes())
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user