-
Notifications
You must be signed in to change notification settings - Fork 227
Add otel tracing instrumentation #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4cf0071
Add opentelemetry tracing
sallyom 3a31c9d
update Dockerfile.sidecar
sallyom da3c416
tracing: remove extra success results & startup spans and cleanup
sallyom 104f3c8
fix: avoid os.Exit bypassing defer in main
sallyom 5ddef7a
fix: address review nits for tracing PR
sallyom 9aedcc9
test: add edge case tests for StripScheme
sallyom 693a029
remove extra comments from sidecar spans
sallyom e7b7d29
fix lint error
sallyom d747153
protect against segfault on tests
Gregory-Pereira 9099259
Merge pull request #1 from Gregory-Pereira/tracing
sallyom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| // Package common contains items common to both the | ||
| // EPP/Inference-Scheduler and the Routing Sidecar | ||
| // | ||
| //revive:disable:var-naming | ||
| package common | ||
|
|
||
| import "testing" | ||
|
|
||
| func TestStripScheme(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| input string | ||
|
elevran marked this conversation as resolved.
|
||
| expected string | ||
| }{ | ||
| { | ||
| name: "http scheme", | ||
| input: "http://localhost:4317", | ||
| expected: "localhost:4317", | ||
| }, | ||
| { | ||
| name: "https scheme", | ||
| input: "https://localhost:4317", | ||
| expected: "localhost:4317", | ||
| }, | ||
| { | ||
| name: "no scheme", | ||
| input: "localhost:4317", | ||
| expected: "localhost:4317", | ||
| }, | ||
| { | ||
| name: "host only", | ||
| input: "localhost", | ||
| expected: "localhost", | ||
| }, | ||
| { | ||
| name: "http with domain", | ||
| input: "http://otel-collector.monitoring.svc.cluster.local:4317", | ||
| expected: "otel-collector.monitoring.svc.cluster.local:4317", | ||
| }, | ||
| { | ||
| name: "https with domain", | ||
| input: "https://otel-collector.monitoring.svc.cluster.local:4317", | ||
| expected: "otel-collector.monitoring.svc.cluster.local:4317", | ||
| }, | ||
| { | ||
| name: "empty string", | ||
| input: "", | ||
| expected: "", | ||
| }, | ||
| { | ||
| name: "ip address with http", | ||
| input: "http://10.0.0.1:4317", | ||
| expected: "10.0.0.1:4317", | ||
| }, | ||
| { | ||
| name: "ip address with https", | ||
| input: "https://10.0.0.1:4317", | ||
| expected: "10.0.0.1:4317", | ||
| }, | ||
| { | ||
| name: "ip address without scheme", | ||
| input: "10.0.0.1:4317", | ||
| expected: "10.0.0.1:4317", | ||
| }, | ||
| { | ||
| name: "schemeless with double slash", | ||
| input: "//192.168.1.1:80", | ||
| expected: "192.168.1.1:80", | ||
| }, | ||
| { | ||
| name: "uppercase scheme", | ||
| input: "HTTP://localhost:4317", | ||
| expected: "localhost:4317", | ||
| }, | ||
| { | ||
| name: "port only", | ||
| input: ":9090", | ||
| expected: ":9090", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| result := StripScheme(tt.input) | ||
| if result != tt.expected { | ||
| t.Errorf("StripScheme(%q) = %q, want %q", tt.input, result, tt.expected) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we ever want to be able to disable this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than introduce a config option, InitTracing is safe to always call - the conditional is within the OTEL SDK so if no collector -> no generated spans (tracer.Start is a no-op) -> no cost. If the default collector is unreachable or doesn't exist, there's no error & negligible overhead.