Skip to content

Commit

Permalink
Add prefix sampling template id, do not wrap error again
Browse files Browse the repository at this point in the history
Signed-off-by: JaeguKim <[email protected]>
  • Loading branch information
JaeguKim committed Apr 13, 2024
1 parent 8118847 commit 04ca6ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugin/storage/es/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func createSpanWriter(
return nil, err
}
if err := writer.CreateTemplates(spanMapping, serviceMapping, cfg.IndexPrefix); err != nil {
return nil, fmt.Errorf("failed to create templates: %w", err)
return nil, err
}
}
return writer, nil
Expand All @@ -313,7 +313,11 @@ func (f *Factory) CreateSamplingStore(maxBuckets int) (samplingstore.Store, erro
if err != nil {
return nil, err

Check warning on line 314 in plugin/storage/es/factory.go

View check run for this annotation

Codecov / codecov/patch

plugin/storage/es/factory.go#L314

Added line #L314 was not covered by tests
}
if _, err := f.getPrimaryClient().CreateTemplate(samplingTemplateId).Body(samplingMapping).Do(context.Background()); err != nil {
normalizedPrefix := f.primaryConfig.IndexPrefix
if normalizedPrefix != "" && !strings.HasSuffix(normalizedPrefix, "-") {
normalizedPrefix += "-"
}
if _, err := f.getPrimaryClient().CreateTemplate(normalizedPrefix + samplingTemplateId).Body(samplingMapping).Do(context.Background()); err != nil {
return nil, fmt.Errorf("failed to create template: %w", err)
}
}
Expand Down

0 comments on commit 04ca6ff

Please sign in to comment.