Repository: jaegertracing/jaeger

Issue:
Remove dead code
### Requirement

Remove dead code from the repository

### Proposal

Use official `deadcode` tool to identify unused code https://mfbmina.dev/en/posts/golang-deadcode/. It currently lists quite a few functions and packages.

### Recommended process

1. Run deadcode tool and pick ONE package to focus on.
2. Post a comment to this issue stating which package you're working on
3. Do not just delete the package / function, do some research first
   * find where (which PR) the function was introduced and what was using it & why
   * ideally find the PR in which that usage was removed without removing the function itself
   * post your findings in the comments to validate with maintainers that it's ok to delete


Hints from issue comments:
@nomic-embed: Hi @yurishkuro,

i have started with identification of unreachable functions with deadcode.
i am working on **cmd/ingester/** module and found out some deadcode but facing issues in pin pointing the related commit and PR.

Any help will be greatly appreciated.

Thanks!! @yurishkuro: You can use git blame to show commits for specific lines, or git log to show history of the whole file. Sometimes files get moved so you may need to follow those moves. Once you have an interesting commit use git show to see more details and the pr number usually will be in the commit message. @nomic-embed: Thanks,

Sure, I will leverage the information for further investigation.@AnmolxSingh: Hi @yurishkuro 
I have been examining the `examples` package and found a function that is not in use https://github.com/jaegertracing/jaeger/blob/cc7ea8d7fd5403c78e0a23db5c6bf06188c32546/examples/hotrod/pkg/pool/pool.go#L41

It was in introduced in pr [#40](https://github.com/jaegertracing/jaeger/pull/40)
and was latest updated in pr [#1454](https://github.com/jaegertracing/jaeger/pull/1454)

I am not able to find or get a clear indication where in the current codebase it was being used.
@yurishkuro: @AnmolxSingh this is because HotROD does not implement proper shutdown sequence, which should be invoked when the program receives a kill signal (other Jaeger binaries do trap the signal and perform shutdown)@AnmolxSingh: Hi @yurishkuro 
while examining the `internal` package I found a function which might be a example of dead code.
https://github.com/jaegertracing/jaeger/blob/f887e133cce1ffcbb4015868025f6bfd4c035764/internal/testutils/logger.go#L90

Just wanted to know is here to serve some purpose?
Introduced in pr [#198](https://github.com/jaegertracing/jaeger/pull/198)@yurishkuro: @AnmolxSingh I'd expect this function to be required by the API in the logging library. It doesn't mean our code would be invoking it directly. How else would the data be written to the buffer by the logging library?

@AnmolxSingh: Hi @yurishkuro,

While examining the codebase, I found that most of the functions identified as unused (dead code) are either:

- Used in `*_test.go` files, or
- Auto-generated by `thrift-0.9.2`.

Aside from those cases and the functions we've already discussed, I didn’t find any other obvious unused functions.

Please let me know if I am missing something.

Thanks!
@blazethunderstorm: hi @yurishkuro can i work on the cmd/collector/app/sanitizer module and investigating the function NewServiceNameSanitizer, which was reported as unreachable.@vtripathi04: Hello @yurishkuro, I am new to this project and thought this is a good issue to start with.

I ran the deadcode tool as suggested and found the file `cmd\query\app\querysvc\query_service_test.go` has dead code in it. 

The functions that are identified as deadcode by the tool are: 

```
unreachable func: fakeStorageFactory1.Initialize
unreachable func: fakeStorageFactory1.CreateSpanReader
unreachable func: fakeStorageFactory1.CreateSpanWriter
unreachable func: fakeStorageFactory1.CreateDependencyReader
```

Upon investigating further I found out all of these functions were introduced in PR  [#1503 ](https://github.com/jaegertracing/jaeger/pull/1503#ref-pullrequest-436336737) , [here](https://github.com/jaegertracing/jaeger/pull/1503/commits/222851654e69566dfce26506866e3150ac364b66#diff-8f0bb159e943f0e3d69c11c0f8a6f9d7ac80d647fba0ed66b7132587a3664d93R264)

and the last PR i could find where major changes were made to this file is #6567, [here](https://github.com/jaegertracing/jaeger/commit/d7ab0f8c175956c1d36bbc2e18b34469f568e205#diff-8f0bb159e943f0e3d69c11c0f8a6f9d7ac80d647fba0ed66b7132587a3664d93R452)

Although I am not sure at what point these functions were used, It seems to me that `fakeStorageFactory1 `and its functions were likely introduced as part of early test scaffolding but were never integrated into actual test logic. Please correct me if I am wrong.

Please let me know if it is safe to remove these functions, and if I can open a PR regarding the same.

Thank you.


@yurishkuro: @AnmolxSingh we can still clean them up from test, but based on your and other comments I have a suspicion that the deadcode tool may incorrectly flag functions that exist because a struct implements a certain interface. Or are those functions truly unnecessary?@blazethunderstorm: @yurishkuro can i work on the one i asked for ?@yurishkuro: @blazethunderstorm you did not provide the analysis asked in the description@blazethunderstorm: @yurishkuro would proivde complete description in a time @AnmolxSingh: @yurishkuro

Apologies if my earlier message was unclear. What I meant was:

- The `deadcode` tool does not analyze `*_test.go` files across packages , so it flags functions as unused even though they are used (it only analyze files reachable from `main.go`).
- Similarly, it seems to flag methods that are required to satisfy interfaces as discussed earlier in previous conversation.
- Having said that, functions marked by it as deadcode are truly necessary as discussed above.

References from documentation:

![Image](https://github.com/user-attachments/assets/2de7db05-008f-41f4-b83b-30646fe23661)

![Image](https://github.com/user-attachments/assets/23e2c688-d65c-44a1-bf19-d8ff1b280cc0)

https://pkg.go.dev/golang.org/x/tools/internal/cmd/deadcode
https://go.dev/blog/deadcode

From what I’ve observed, `deadcode` mainly checks for direct callability (similar to what IDEs trace with “Ctrl+Click” navigation).

If the community is open to it, we might explore more tools which might be a better option.
Thanks!
@yurishkuro: > so it flags functions as unused even though they are used (it only analyze files reachable from main.go)

I wouldn't say this is wrong. There's no point in testing some functions if they are never used in the actual binaries.

> it seems to flag methods that are required to satisfy interfaces as discussed earlier in previous conversation.

that is definitely a problem & doesn't make any sense as a behavior of a tool with this purpose. Is it confirmed somewhere, like a bug report about this "official" tool?

Did you find any other similar tools?@AnmolxSingh: > that is definitely a problem & doesn't make any sense as a behavior of a tool with this purpose. Is it confirmed somewhere, like a bug report about this "official" tool?

actually I did not find report about this thing but the documentation gives some sort of indication for this behavior as attached in the previous comment. 
"_For example, a dead function may be referenced by another dead function, and a dead method may be required to satisfy an interface that is never called. Some judgement is required._" 

I haven't tried other tools but I feel `staticcheck` might be a possible option.

And reading about this tool it is not an official tool by the go team and now not much useful compared to other tools like
`staticcheck`@wololowarrior: `staticheck` doesn't seem to be flagging any deadcode.

```
U1000 Unused code
harshil.gupta@harshil jaeger % staticcheck -checks U1000 ./... 
```@yurishkuro: I don't know how accurate it is but AI says that staticcheck's deadcode detection doesn't work for exported functions that may be used in other packages

> Whole-program analysis limitations: In previous versions, Staticcheck had a "whole-program mode" (--unused.whole-program=true) which aimed to find unused exported identifiers even across a large program. However, this mode was removed in Staticcheck 2020.2 due to issues with caching and flakiness. Currently, Staticcheck's primary dead code detection (U1000) will consider all exported package-level identifiers as used, even if they are otherwise unused in the immediate package. This means it might not catch dead exported functions or types that are part of a library but are never imported or called by any consumers of that library. For finding true "whole-program" dead code (across multiple packages in a large monorepo, for example), you might need complementary tools or approaches.@Parship999: ## Working on: `cmd/collector/app/sanitizer/cache/` package
- when introduced: PR #67 
  - The cache package implemented a auto-refreshing cache system for service names:
    - `ServiceAliasMappingExternalSource` - load mappings from external sources
    - `ServiceAliasMappingStorage` - mappings to storage
    - `autoRefreshCache` - auto-refresh from both sources with intervals
    - used by `NewServiceNameSanitizer()` to map service aliases to canonical names

- When usage was removed: PR #3631 
  - added `NewEmptyServiceNameSanitizer()` as replacement
  - Created `NewStandardSanitizers()` function that excluded the cache-based sanitizer and alsso the cache-based `NewServiceNameSanitizer()` was never included in standard sanitizers

- I have not found any production usage:
  - `NewServiceNameSanitizer()` only used in test files (`service_name_sanitizer_test.go`)
  - Current `NewStandardSanitizers()` only includes:
    - `NewEmptyServiceNameSanitizer()` (simple, no cache)
    - `NewNegativeDurationSanitizer()` (simple, no cache)

Files that can be removed safely:
`cmd/collector/app/sanitizer/cache/` (entire directory)
`cmd/collector/app/sanitizer/service_name_sanitizer.go`
`cmd/collector/app/sanitizer/service_name_sanitizer_test.go`

This seems to be replaced by the solution in PR #3631 but the original implementation was not cleaned up. 

@yurishkuro 
I have used deadcode and also tried staticcheck but i saw that `.golangci.yml` has `staticcheck` in the disable list. Even when enabled still didn't detect the unused cache functions. 
I verified this is not a false positive. The cache package defines its own cache interface that's completely separate from the actively used `internal/cache.Cache` interface@yurishkuro: @Parship999 I don't see any mentioning of sanitizer/cache in #3631, if the usage was remove there some import or calls to NewAutoRefreshCache would've been removed@Parship999: > [@Parship999](https://github.com/Parship999) I don't see any mentioning of sanitizer/cache in [#3631](https://github.com/jaegertracing/jaeger/pull/3631), if the usage was remove there some import or calls to NewAutoRefreshCache would've been removed

Sorry, i made a mistake.
actually, the cache package is never used in production at all. Git history shows: PR #67 added the cache infrastructure (`NewAutoRefreshCache()`, `NewServiceNameSanitizer()`) but never used in prod. So no commits ever removed the usage, as there was no uage to remove. PR #3631 added `NewStandardSanitizers()`, but this actually the new functionality, not replacing cache usage. I think it may be unused since day one. The removal is still safe but the past context i provided is incorrect.
Can you please verify it?@yurishkuro: ok that makes sense. IIRC this was a function that was invoked in Uber's custom build of the binary - it didn't need to be open sourced. Feel free to remove.@wololowarrior: @yurishkuro Working on [internal/converter/thrift/jaeger/from_domain.go](https://github.com/jaegertracing/jaeger/blob/main/internal/converter/thrift/jaeger/from_domain.go), it appears that only the test file `from_domain_test.go` is utilizing it.  I can't find any real usage of the file. 
It was added as part of https://github.com/jaegertracing/jaeger/pull/65. 
Tracing is becoming sweaty for me as the pr is from 8 years ago. @yurishkuro Pls take a look while I trace its first usage@Parship999: @yurishkuro 
### Working on `cmd/all-in-one/setupcontext` package

- Package: `cmd/all-in-one/setupcontext`
  - Total functions: 3 (`SetAllInOne`, `UnsetAllInOne`, `IsAllInOne`)
  - aead functions: 2 (`UnsetAllInOne`, `IsAllInOne`)
  - active functions: 1 (`SetAllInOne`)

- current usage:
  - `SetAllInOne()`: used in `cmd/all-in-one/main.go` line 50
  - `UnsetAllInOne()`, `IsAllInOne()`: only used in test file for code coverage

- Introduced: PR #1854
- usage removed: #6868 as part of issue #4739
- Deadcode confuimation:
<img width="591" height="36" alt="Image" src="https://github.com/user-attachments/assets/413ab64e-f508-48a8-9a05-58d030e8e66e" />

- files to modify are `cmd/all-in-one/setupcontext/setupcontext.go`, `cmd/all-in-one/setupcontext/setupcontext_test.go`@yurishkuro: @Parship999 +1. IsAllInOne was only used for agent tags, and we don't have that anymore.@Parship999: > [@Parship999](https://github.com/Parship999) +1. IsAllInOne was only used for agent tags, and we don't have that anymore.

Thanks for confirming. Should I go ahead and remove it?@yurishkuro: that's what +1 was for :-)@wololowarrior: > [@yurishkuro](https://github.com/yurishkuro) Working on [internal/converter/thrift/jaeger/from_domain.go](https://github.com/jaegertracing/jaeger/blob/main/internal/converter/thrift/jaeger/from_domain.go), it appears that only the test file `from_domain_test.go` is utilizing it. I can't find any real usage of the file. It was added as part of [#65](https://github.com/jaegertracing/jaeger/pull/65). Tracing is becoming sweaty for me as the pr is from 8 years ago. [@yurishkuro](https://github.com/yurishkuro) Pls take a look while I trace its first usage

@yurishkuro updates

Some background info first:
- `/model/` was moved to `/internal/` in [this](https://github.com/jaegertracing/jaeger/pull/6917/files#diff-ff098a2fa68c02a5d7084d463fc2916787066cbec047139e28d505577bf655b8) pr
- This info is important cause the below references are using `/model/` but then it was moved to `internal`

Added:
The only place I could find the use of  methods from `from_domain.go` is [here](https://github.com/jaegertracing/jaeger/pull/862/files#diff-f24753e235d3fb6d0b2264d42c52c1455bbdd4a9e75dfd4a410d88840aa12578R41)
- Uses `FromDomainSpan`


Removed:
From the [pr](https://github.com/jaegertracing/jaeger/pull/868/files#diff-f24753e235d3fb6d0b2264d42c52c1455bbdd4a9e75dfd4a410d88840aa12578R39) removing usage of `FromDomainSpan`. 
```
Thrift model doesn't have the process in the definition, therefore encoding causes loss of data when writing
```

Summary on:
`from_domain.go`
- Has 7 methods, of which 
  - All 7 of them are not used anywhere else in business logic.
  - `FromDomain`, `FromDomainSpan`, `keyValueToTag` are used in `from_domain_test.go`@Parship999: ### Working on: `cmd/collector/app/sanitizer/utf8_sanitizer.go`
- When introduced: PR #67
- When replaced: PR #6078 (New UTF8 sanitizer implemented for OTLP/ptrace data (`ptrace.Traces`), located at  `internal/jptrace/sanitizer/utf8.go`)
- Current state: two different UTF8 sanitizers exist:
  - Old and unused (`cmd/collector/app/sanitizer/utf8_sanitizer.go`)
  - New and used (`internal/jptrace/sanitizer/utf8.go`)
- I have not found any prod usage:
  - old UTF8 sanitizer only used in its own test file (`utf8_sanitizer_test.go`)
  - the new OTLP-based UTF8 sanitizer handles all UTF8 sanitization needs
- Files to remove safely:
   - `cmd/collector/app/sanitizer/utf8_sanitizer.go`
   - `cmd/collector/app/sanitizer/utf8_sanitizer_test.go`

@yurishkuro can you please confirm this analysis is correct or not?@Parship999: @yurishkuro 
### Working on: `cmd/collector/app/sanitizer/service_name_sanitizer.go`
- When introduced: PR #67
- when replaced:
  - First Replacement - PR #3631
  - modern OTLP implementation - PR #6077
  - final location - PR #7158
- Current State:
  - Old-dead `cmd/collector/app/sanitizer/service_name_sanitizer.go`
  - Legacy-used `cmd/collector/app/sanitizer/empty_service_name_sanitizer.go`
  - Modern-used `internal/jptrace/sanitizer/emptyservicename.go`
- No prod usage
- Files to remove:
  - `cmd/collector/app/sanitizer/service_name_sanitizer.go`
  - `cmd/collector/app/sanitizer/service_name_sanitizer_test.go`@yurishkuro: @Parship999 delete it, it was closely coupled with Cache@wololowarrior: @yurishkuro Does https://github.com/jaegertracing/jaeger/issues/7261#issuecomment-3101299309 makes sense ? Should I go ahead with a PR? @yurishkuro: @wololowarrior yes@Parship999: @yurishkuro 
### Working on: `examples/hotrod/pkg/pool/pool.go` (`Pool.Stop` Method)
- Files identified by deadcode tool: `examples/hotrod/pkg/pool/pool.go`: - `Pool.Stop` method unreachable
- When introduced: PR #40
- When fixed: PR #1454
- current state: `Pool.Stop()` method is never called anywhere in the codebase. Only `Pool.New()` and `Pool.Execute()` are used in production
- Files to modify: `examples/hotrod/pkg/pool/pool.go` - remove `Stop()` method (lines 40-45)@Parship999: @yurishkuro 
### Working on:  `internal/jptrace/utf8.go`
- Files identified by deadcode tool: `internal/jptrace/utf8.go` - `SanitizeUTF8` function unreachable
- When introduced: PR #7128
- When unused: the pr that introduced it never actually used the function
- The fix was implemented by switching from `WithLabelValues()` to `GetMetricWithLabelValues()` in the prometheus factory, the `SanitizeUTF8` function was added but never used.
- Files to remove:
  - `internal/jptrace/utf8.go`
  - `internal/jptrace/utf8_test.go`@Parship999: > [@yurishkuro](https://github.com/yurishkuro)
> 
> ### Working on: `examples/hotrod/pkg/pool/pool.go` (`Pool.Stop` Method)
> * Files identified by deadcode tool: `examples/hotrod/pkg/pool/pool.go`: - `Pool.Stop` method unreachable
> * When introduced: PR [Add demo tracing app #40](https://github.com/jaegertracing/jaeger/pull/40)
> * When fixed: PR [Fix HotRod job pool termination (#1453) #1454](https://github.com/jaegertracing/jaeger/pull/1454)
> * current state: `Pool.Stop()` method is never called anywhere in the codebase. Only `Pool.New()` and `Pool.Execute()` are used in production
> * Files to modify: `examples/hotrod/pkg/pool/pool.go` - remove `Stop()` method (lines 40-45)

@yurishkuro can you please verify this one? `Pool.Stop()`

Solution patch:
diff --git a/cmd/collector/app/sanitizer/utf8_sanitizer.go b/cmd/collector/app/sanitizer/utf8_sanitizer.go
deleted file mode 100644
index ba2e4581..00000000
--- a/cmd/collector/app/sanitizer/utf8_sanitizer.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2019 The Jaeger Authors.
-// Copyright (c) 2017 Uber Technologies, Inc.
-// SPDX-License-Identifier: Apache-2.0
-
-package sanitizer
-
-import (
-	"fmt"
-	"unicode/utf8"
-
-	"go.uber.org/zap"
-	"go.uber.org/zap/zapcore"
-
-	"github.com/jaegertracing/jaeger-idl/model/v1"
-)
-
-const (
-	invalidOperation = "InvalidOperationName"
-	invalidService   = "InvalidServiceName"
-	invalidTagKey    = "InvalidTagKey"
-)
-
-// utf8Sanitizer sanitizes all strings in spans
-type utf8Sanitizer struct {
-	logger *zap.Logger
-}
-
-// NewUTF8Sanitizer creates a UTF8 sanitizer.
-func NewUTF8Sanitizer(logger *zap.Logger) SanitizeSpan {
-	utf8Sanitizer := utf8Sanitizer{logger: logger}
-	return utf8Sanitizer.Sanitize
-}
-
-// Sanitize sanitizes the UTF8 in the spans.
-func (s *utf8Sanitizer) Sanitize(span *model.Span) *model.Span {
-	if !utf8.ValidString(span.OperationName) {
-		s.logSpan(span, "Invalid utf8 operation name", zap.String("operation_name", span.OperationName))
-		span.Tags = append(span.Tags, model.Binary(invalidOperation, []byte(span.OperationName)))
-		span.OperationName = invalidOperation
-	}
-	if !utf8.ValidString(span.Process.ServiceName) {
-		s.logSpan(span, "Invalid utf8 service name", zap.String("service_name", span.Process.ServiceName))
-		span.Tags = append(span.Tags, model.Binary(invalidService, []byte(span.Process.ServiceName)))
-		span.Process.ServiceName = invalidService
-	}
-	sanitizeKV(span.Process.Tags)
-	sanitizeKV(span.Tags)
-	for _, log := range span.Logs {
-		sanitizeKV(log.Fields)
-	}
-	return span
-}
-
-func (s *utf8Sanitizer) logSpan(span *model.Span, message string, field zapcore.Field) {
-	s.logger.Info(
-		message,
-		zap.String("trace_id", span.TraceID.String()),
-		zap.String("span_id", span.SpanID.String()), field)
-}
-
-func sanitizeKV(keyValues model.KeyValues) {
-	for i, kv := range keyValues {
-		if !utf8.ValidString(kv.Key) {
-			keyValues[i] = model.Binary(invalidTagKey, []byte(fmt.Sprintf("%s:%s", kv.Key, kv.AsStringLossy())))
-		} else if kv.VType == model.StringType && !utf8.ValidString(kv.VStr) {
-			keyValues[i] = model.Binary(kv.Key, []byte(kv.VStr))
-		}
-	}
-}



Test patch:
diff --git a/cmd/collector/app/sanitizer/utf8_sanitizer_test.go b/cmd/collector/app/sanitizer/utf8_sanitizer_test.go
deleted file mode 100644
index 8bb802a4..00000000
--- a/cmd/collector/app/sanitizer/utf8_sanitizer_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) 2019 The Jaeger Authors.
-// Copyright (c) 2017 Uber Technologies, Inc.
-// SPDX-License-Identifier: Apache-2.0
-
-package sanitizer
-
-import (
-	"encoding/hex"
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-	"go.uber.org/zap"
-
-	"github.com/jaegertracing/jaeger-idl/model/v1"
-)
-
-func invalidUTF8() string {
-	s, _ := hex.DecodeString("fefeffff")
-	return string(s)
-}
-
-var (
-	invalidKV = model.KeyValues{
-		model.KeyValue{
-			Key:   invalidUTF8(),
-			VType: model.StringType,
-			VStr:  "value",
-		},
-	}
-	undertest = NewUTF8Sanitizer(zap.NewNop())
-)
-
-func TestUTF8Sanitizer_SanitizeKV(t *testing.T) {
-	tests := []struct {
-		input    model.KeyValues
-		expected model.KeyValues
-	}{
-		{
-			input: model.KeyValues{
-				model.String("valid key", "valid value"),
-			},
-			expected: model.KeyValues{
-				model.String("valid key", "valid value"),
-			},
-		},
-		{
-			input: model.KeyValues{
-				model.String(invalidUTF8(), "value"),
-			},
-			expected: model.KeyValues{
-				model.Binary(invalidTagKey, []byte(invalidUTF8()+":value")),
-			},
-		},
-		{
-			input: model.KeyValues{
-				model.String("valid key", invalidUTF8()),
-			},
-			expected: model.KeyValues{
-				model.Binary("valid key", []byte(invalidUTF8())),
-			},
-		},
-		{
-			input: model.KeyValues{
-				model.String(invalidUTF8(), invalidUTF8()),
-			},
-			expected: model.KeyValues{
-				model.Binary(invalidTagKey, []byte(invalidUTF8()+":"+invalidUTF8())),
-			},
-		},
-		{
-			input: model.KeyValues{
-				model.Binary(invalidService, []byte(invalidUTF8())),
-			},
-			expected: model.KeyValues{
-				model.Binary(invalidService, []byte(invalidUTF8())),
-			},
-		},
-	}
-	for _, kv := range tests {
-		sanitizeKV(kv.input)
-		assert.Equal(t, kv.expected, kv.input)
-	}
-}
-
-func TestUTF8Sanitizer_SanitizeServiceName(t *testing.T) {
-	actual := undertest(
-		&model.Span{
-			Process: &model.Process{
-				ServiceName: invalidUTF8(),
-			},
-		})
-	assert.Equal(t, invalidService, actual.Process.ServiceName)
-	assert.Equal(t, model.Binary(invalidService, []byte(invalidUTF8())), actual.Tags[0])
-}
-
-func TestUTF8Sanitizer_SanitizeOperationName(t *testing.T) {
-	actual := undertest(&model.Span{
-		OperationName: invalidUTF8(),
-		Process:       &model.Process{},
-	})
-	assert.Equal(t, invalidOperation, actual.OperationName)
-	assert.Equal(t, model.Binary(invalidOperation, []byte(invalidUTF8())), actual.Tags[0])
-}
-
-func TestUTF8Sanitizer_SanitizeProcessTags(t *testing.T) {
-	actual := undertest(
-		&model.Span{
-			Process: &model.Process{
-				Tags: invalidKV,
-			},
-		},
-	)
-	_, exists := model.KeyValues(actual.Process.Tags).FindByKey(invalidTagKey)
-	assert.True(t, exists)
-}
-
-func TestUTF8Sanitizer_SanitizeTags(t *testing.T) {
-	actual := undertest(
-		&model.Span{
-			Tags:    invalidKV,
-			Process: &model.Process{},
-		},
-	)
-	_, exists := model.KeyValues(actual.Tags).FindByKey(invalidTagKey)
-	assert.True(t, exists)
-}
-
-func TestUTF8Sanitizer_SanitizeLogs(t *testing.T) {
-	actual := undertest(
-		&model.Span{
-			Logs: []model.Log{
-				{Fields: invalidKV},
-			},
-			Process: &model.Process{},
-		},
-	)
-	assert.Equal(t, invalidTagKey, actual.Logs[0].Fields[0].Key)
-}