Tagging #2

Merged
dstepanov-yadro merged 2 commits from dstepanov-yadro/frostfs-qos:feat/tagging into master 2025-01-28 11:34:10 +00:00

Add methods to set/get IO tag from context.Context and grpc.Metadata

Add methods to set/get IO tag from `context.Context` and `grpc.Metadata`
dstepanov-yadro added 5 commits 2025-01-21 09:26:02 +00:00
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
[#1] Makefile: Create directory with parents
Some checks failed
DCO action / DCO (pull_request) Successful in 30s
Tests and linters / Run gofumpt (pull_request) Successful in 27s
Vulncheck / Vulncheck (pull_request) Successful in 37s
Tests and linters / Staticcheck (pull_request) Successful in 45s
Pre-commit hooks / Pre-commit (pull_request) Failing after 52s
Tests and linters / Lint (pull_request) Successful in 1m4s
Tests and linters / Tests (pull_request) Successful in 1m9s
Tests and linters / gopls check (pull_request) Successful in 1m15s
Tests and linters / Tests with -race (pull_request) Successful in 1m40s
95ccf46c64
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
[#1] pre-commit: Use local golangci-lint hook
All checks were successful
DCO action / DCO (pull_request) Successful in 28s
Tests and linters / Run gofumpt (pull_request) Successful in 27s
Vulncheck / Vulncheck (pull_request) Successful in 31s
Tests and linters / Staticcheck (pull_request) Successful in 40s
Tests and linters / Lint (pull_request) Successful in 1m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m12s
Tests and linters / Tests (pull_request) Successful in 1m18s
Tests and linters / Tests with -race (pull_request) Successful in 1m19s
Tests and linters / gopls check (pull_request) Successful in 1m24s
c6789eea71
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
[#2] Add CODEOWNERS
Some checks failed
DCO action / DCO (pull_request) Successful in 27s
Tests and linters / Run gofumpt (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 37s
Tests and linters / Tests (pull_request) Successful in 45s
Tests and linters / Tests with -race (pull_request) Successful in 50s
Tests and linters / Staticcheck (pull_request) Successful in 1m3s
Pre-commit hooks / Pre-commit (pull_request) Failing after 1m29s
Tests and linters / Lint (pull_request) Successful in 1m35s
Tests and linters / gopls check (pull_request) Successful in 1m37s
c208b6d71d
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
dstepanov-yadro force-pushed feat/tagging from c208b6d71d to 9c7de1765c 2025-01-21 09:40:09 +00:00 Compare
dstepanov-yadro force-pushed feat/tagging from 9c7de1765c to 678400574e 2025-01-24 13:01:57 +00:00 Compare
dstepanov-yadro added 1 commit 2025-01-24 13:03:23 +00:00
[#2] Makefile: Create directory with parents
Some checks failed
DCO action / DCO (pull_request) Successful in 27s
Tests and linters / Tests with -race (pull_request) Successful in 31s
Vulncheck / Vulncheck (pull_request) Successful in 36s
Tests and linters / Run gofumpt (pull_request) Successful in 37s
Pre-commit hooks / Pre-commit (pull_request) Failing after 48s
Tests and linters / Tests (pull_request) Successful in 48s
Tests and linters / Staticcheck (pull_request) Successful in 50s
Tests and linters / Lint (pull_request) Successful in 1m20s
Tests and linters / gopls check (pull_request) Successful in 1m55s
455d6ac42e
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
dstepanov-yadro added 1 commit 2025-01-24 13:06:56 +00:00
[#2] pre-commit: Use local golangci-lint hook
All checks were successful
DCO action / DCO (pull_request) Successful in 28s
Tests and linters / Run gofumpt (pull_request) Successful in 36s
Vulncheck / Vulncheck (pull_request) Successful in 37s
Tests and linters / Staticcheck (pull_request) Successful in 49s
Tests and linters / Lint (pull_request) Successful in 1m12s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m20s
Tests and linters / Tests with -race (pull_request) Successful in 1m21s
Tests and linters / gopls check (pull_request) Successful in 1m36s
Tests and linters / Tests (pull_request) Successful in 1m41s
6683cb983f
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
dstepanov-yadro changed title from WIP: Add tagging to Tagging 2025-01-24 13:10:39 +00:00
requested reviews from storage-core-committers, storage-core-developers 2025-01-24 13:10:46 +00:00
aarifullin reviewed 2025-01-24 14:20:33 +00:00
@ -0,0 +2,4 @@
import "context"
type tagContextKeyType int
Member

Using int/string as a key within Context may cause some problems. You should introduce:

type tagContextKeyType struct{}

var currentTagKey = tagContextKeyType{}

You can check this out

Using `int`/`string` as a key within `Context` may cause some problems. You should introduce: ```go type tagContextKeyType struct{} var currentTagKey = tagContextKeyType{} ``` You can check [this](https://gist.github.com/ww9/4ad7b2ddfb94816a30dfdf2218e02f48) out
Author
Member

Details:

	// This also applies to int keys. Same type means equal:
	compareKeys(IntKey1(0), IntKey1(0)) // true
	// And different keys are never equal even though they have 0 value:
	compareKeys(IntKey1(0), IntKey2(0)) // false
	// However, unlike struct{}, an int typed key allows for mistakes with the value:
	compareKeys(IntKey1(0), IntKey1(1)) // false
	// To add to why you shouldn't use int typed keys, when seeing that the package define a
	// key as int, the user might be tempted to pass a primitive 0 instead. Which doesn't work:
	compareKeys(IntKey1(0), 0) // false

But tagContextKeyType is internal as const currentTagKey tagContextKeyType = iota

Details: ``` // This also applies to int keys. Same type means equal: compareKeys(IntKey1(0), IntKey1(0)) // true // And different keys are never equal even though they have 0 value: compareKeys(IntKey1(0), IntKey2(0)) // false // However, unlike struct{}, an int typed key allows for mistakes with the value: compareKeys(IntKey1(0), IntKey1(1)) // false // To add to why you shouldn't use int typed keys, when seeing that the package define a // key as int, the user might be tempted to pass a primitive 0 instead. Which doesn't work: compareKeys(IntKey1(0), 0) // false ``` But `tagContextKeyType` is internal as `const currentTagKey tagContextKeyType = iota`
Member

My initial concern was about whether currentTagKey overrides currentTagKeyFromSomeOtherPackageWithTheSameIOTA. I checked it on my own: it's fine, context keeps two keys. So, nevermind!

My initial concern was about whether `currentTagKey ` overrides `currentTagKeyFromSomeOtherPackageWithTheSameIOTA`. I checked it on my own: it's fine, context keeps two keys. So, nevermind!
aarifullin marked this conversation as resolved
aarifullin approved these changes 2025-01-24 14:50:24 +00:00
aarifullin left a comment
Member

👍

👍
fyrchik approved these changes 2025-01-28 11:21:15 +00:00
elebedeva approved these changes 2025-01-28 11:29:19 +00:00
dstepanov-yadro force-pushed feat/tagging from 6683cb983f to 128933fade 2025-01-28 11:29:54 +00:00 Compare
dstepanov-yadro merged commit 128933fade into master 2025-01-28 11:34:10 +00:00
dstepanov-yadro referenced this pull request from a commit 2025-01-28 11:34:11 +00:00
Sign in to join this conversation.
No description provided.