-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Add esmapping-generator into jaeger binary #6327
base: main
Are you sure you want to change the base?
Conversation
@yurishkuro I think now this is perfectly decoupling the logic for generation in tool and then calling it from jaeger binary. Looking forward to your suggestions! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6327 +/- ##
===========================================
- Coverage 96.27% 50.21% -46.07%
===========================================
Files 372 188 -184
Lines 21283 11405 -9878
===========================================
- Hits 20491 5727 -14764
- Misses 605 5220 +4615
- Partials 187 458 +271
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
"go.uber.org/zap" | ||
) | ||
|
||
func GenerateESMappings(logger *zap.Logger, options app.Options) error { |
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.
- this can be in the app/ package
- can be called GenerateMappings ("ES" is implied)
- as a library function it needs to return the results, not print them. The caller can decide what to do with the string.
|
||
fmt.Println(parsedMapping) | ||
return nil | ||
} |
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.
needs tests
@@ -0,0 +1,26 @@ | |||
package es |
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.
this package is not a place for commands. Can move it to cmd/esmapping-generator/app/command.go
Short: "Generate Elasticsearch mappings", | ||
Long: "Generate Elasticsearch mappings using jaeger-esmapping-generator functionality", | ||
Run: func(_ *cobra.Command, _ []string) { | ||
if err := renderer.GenerateESMappings(logger, options); err != nil { |
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.
where are options
populated?
cmd/esmapping-generator/main.go
Outdated
@@ -25,19 +23,13 @@ func main() { | |||
Short: "Jaeger esmapping-generator prints rendered mappings as string", | |||
Long: `Jaeger esmapping-generator renders passed templates with provided values and prints rendered output to stdout`, | |||
Run: func(_ *cobra.Command, _ /* args */ []string) { | |||
if _, err := mappings.MappingTypeFromString(options.Mapping); err != nil { |
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.
how is this command different from the new one you defined? Merge into one?
Signed-off-by: Rohanraj123 <rajrohan88293@gmail.com>
24c7af6
to
01ad9bc
Compare
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.
how is a user expected to run this?
@@ -199,6 +200,7 @@ by default uses only in-memory database.`, | |||
command.AddCommand(docs.Command(v)) | |||
command.AddCommand(status.Command(v, ports.CollectorAdminHTTP)) | |||
command.AddCommand(printconfig.Command(v)) | |||
command.AddCommand(esmapping.Command(svc.Logger)) |
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.
no need to add this to v1 binaries, only cmd/jaeger
"github.com/jaegertracing/jaeger/cmd/esmapping-generator/app" | ||
"github.com/jaegertracing/jaeger/cmd/esmapping-generator/app/renderer" | ||
"github.com/jaegertracing/jaeger/pkg/es" | ||
"github.com/jaegertracing/jaeger/pkg/version" | ||
"github.com/jaegertracing/jaeger/plugin/storage/es/mappings" | ||
"github.com/spf13/cobra" | ||
"go.uber.org/zap" |
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.
run make fmt
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test