-
Notifications
You must be signed in to change notification settings - Fork 217
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
feat/proposal: Deprecate jaeger enabled #1316
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb0d00d
feat: deprecate jaeger enabled in favor or specifying tracing exporter
markphelps 2d9b8ad
chore: update example config; cue/json schemas
markphelps e1d8e0b
chore: switch to 'backend'
markphelps 253adcc
Merge branch 'main' into deprecate-jaeger-enabled
markphelps dcd6d01
chore: missed a few renames
markphelps f57704f
chore: missed in deprecations.md
markphelps 9f6efe8
chore: change log msg
markphelps b56ce8d
chore: fix misspelled dep msg var
markphelps 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 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 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 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 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 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 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 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 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 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 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
3 changes: 3 additions & 0 deletions
3
internal/config/testdata/deprecated/tracing_jaeger_enabled.yml
This file contains 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,3 @@ | ||
tracing: | ||
jaeger: | ||
enabled: true |
This file contains 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 |
---|---|---|
@@ -1,30 +1,84 @@ | ||
package config | ||
|
||
import "github.com/spf13/viper" | ||
import ( | ||
"encoding/json" | ||
|
||
"github.com/spf13/viper" | ||
) | ||
|
||
// cheers up the unparam linter | ||
var _ defaulter = (*TracingConfig)(nil) | ||
|
||
// JaegerTracingConfig contains fields, which configure specifically | ||
// Jaeger span and tracing output destination. | ||
type JaegerTracingConfig struct { | ||
Enabled bool `json:"enabled,omitempty" mapstructure:"enabled"` | ||
Host string `json:"host,omitempty" mapstructure:"host"` | ||
Port int `json:"port,omitempty" mapstructure:"port"` | ||
} | ||
|
||
// TracingConfig contains fields, which configure tracing telemetry | ||
// output destinations. | ||
type TracingConfig struct { | ||
Jaeger JaegerTracingConfig `json:"jaeger,omitempty" mapstructure:"jaeger"` | ||
Enabled bool `json:"enabled,omitempty" mapstructure:"enabled"` | ||
Exporter TracingExporter `json:"exporter,omitempty" mapstructure:"exporter"` | ||
Jaeger JaegerTracingConfig `json:"jaeger,omitempty" mapstructure:"jaeger"` | ||
} | ||
|
||
func (c *TracingConfig) setDefaults(v *viper.Viper) { | ||
v.SetDefault("tracing", map[string]any{ | ||
"enabled": false, | ||
"exporter": TracingJaeger, | ||
"jaeger": map[string]any{ | ||
"enabled": false, | ||
"enabled": false, // deprecated (see below) | ||
"host": "localhost", | ||
"port": 6831, | ||
}, | ||
}) | ||
|
||
if v.GetBool("tracing.jaeger.enabled") { | ||
// forcibly set top-level `enabled` to true | ||
v.Set("tracing.enabled", true) | ||
v.Set("tracing.exporter", TracingJaeger) | ||
} | ||
} | ||
|
||
func (c *TracingConfig) deprecations(v *viper.Viper) []deprecation { | ||
var deprecations []deprecation | ||
|
||
if v.InConfig("tracing.jaeger.enabled") { | ||
deprecations = append(deprecations, deprecation{ | ||
|
||
option: "tracing.jaeger.enabled", | ||
additionalMessage: deprecatedMsgTracingJaegerEnabled, | ||
}) | ||
} | ||
|
||
return deprecations | ||
} | ||
|
||
// TracingExporter represents the supported tracing exporters | ||
type TracingExporter uint8 | ||
|
||
func (e TracingExporter) String() string { | ||
return tracingExporterToString[e] | ||
} | ||
|
||
func (e TracingExporter) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(e.String()) | ||
} | ||
|
||
const ( | ||
_ TracingExporter = iota | ||
// TracingJaeger ... | ||
TracingJaeger | ||
) | ||
|
||
var ( | ||
tracingExporterToString = map[TracingExporter]string{ | ||
TracingJaeger: "jaeger", | ||
} | ||
|
||
stringToTracingExporter = map[string]TracingExporter{ | ||
"jaeger": TracingJaeger, | ||
} | ||
) | ||
|
||
// JaegerTracingConfig contains fields, which configure specifically | ||
// Jaeger span and tracing output destination. | ||
type JaegerTracingConfig struct { | ||
Host string `json:"host,omitempty" mapstructure:"host"` | ||
Port int `json:"port,omitempty" mapstructure:"port"` | ||
} |
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.
I think you can forgo making this optional if there is a default.
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.
Actually with
exporter
you might be able to get away with just:Which just says if you specify the key
exporter
it must be the value"jaeger"
.And drop the default.
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.
i'll prob just leave this as is for now since we will very shortly allow others besides
jaeger