Skip to content
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

Add storage metrics to OTEL, metrics by span service name #2431

Merged
merged 5 commits into from
Sep 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix itest
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay committed Sep 3, 2020
commit 668c97f479e94a7b170300a91eba8b885f9be493
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ import (
"github.com/jaegertracing/jaeger/cmd/opentelemetry/app/internal/esclient"
"github.com/jaegertracing/jaeger/cmd/opentelemetry/app/internal/reader/es/esdependencyreader"
"github.com/jaegertracing/jaeger/cmd/opentelemetry/app/internal/reader/es/esspanreader"
"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/pkg/es/config"
"github.com/jaegertracing/jaeger/pkg/testutils"
"github.com/jaegertracing/jaeger/plugin/storage/es"
"github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel"
"github.com/jaegertracing/jaeger/plugin/storage/integration"
"github.com/jaegertracing/jaeger/storage/spanstore"
)

const (
Expand All @@ -49,6 +47,8 @@ const (
indexPrefix = "integration-test"
tagKeyDeDotChar = "@"
maxSpanAge = time.Hour * 72
numShards = 5
numReplicas = 0
)

type IntegrationTest struct {
Expand All @@ -57,23 +57,6 @@ type IntegrationTest struct {
logger *zap.Logger
}

type storageWrapper struct {
writer *esSpanWriter
}

var _ spanstore.Writer = (*storageWrapper)(nil)

func (s storageWrapper) WriteSpan(ctx context.Context, span *model.Span) error {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the storage factory has a similar impl I have used that instead.

// This fails because there is no binary tag type in OTEL and also OTEL span's status code is always created
//traces := jaegertranslator.ProtoBatchesToInternalTraces([]*model.Batch{{Process: span.Process, Spans: []*model.Span{span}}})
//_, err := s.writer.WriteTraces(context.Background(), traces)
// TODO set tags as keys
converter := dbmodel.FromDomain{}
dbSpan := converter.FromDomainEmbedProcess(span)
_, err := s.writer.writeSpans(ctx, []*dbmodel.Span{dbSpan})
return err
}

func (s *IntegrationTest) initializeES(allTagsAsFields bool) error {
s.logger, _ = testutils.NewLogger()

Expand All @@ -97,7 +80,11 @@ func (s *IntegrationTest) esCleanUp(allTagsAsFields bool) error {
if err != nil {
return err
}
defer response.Body.Close()
err = response.Body.Close()
if err != nil {
return err
}
// initialize writer, it caches service names
return s.initSpanstore(allTagsAsFields)
}

Expand All @@ -114,13 +101,14 @@ func (s *IntegrationTest) initSpanstore(allTagsAsFields bool) error {
return err
}
esVersion := uint(w.esClientVersion())
spanMapping, serviceMapping := es.GetSpanServiceMappings(1, 0, esVersion)
spanMapping, serviceMapping := es.GetSpanServiceMappings(numShards, numReplicas, esVersion)
err = w.CreateTemplates(context.Background(), spanMapping, serviceMapping)
if err != nil {
return err
}
s.SpanWriter = storageWrapper{
s.SpanWriter = singleSpanWriter{
writer: w,
converter: dbmodel.NewFromDomain(allTagsAsFields, []string{}, tagKeyDeDotChar),
}

elasticsearchClient, err := esclient.NewElasticsearchClient(cfg, s.logger)
Expand All @@ -135,7 +123,7 @@ func (s *IntegrationTest) initSpanstore(allTagsAsFields bool) error {
})
s.SpanReader = reader

depMapping := es.GetDependenciesMappings(1, 0, esVersion)
depMapping := es.GetDependenciesMappings(numShards, numReplicas, esVersion)
depStore := esdependencyreader.NewDependencyStore(elasticsearchClient, s.logger, indexPrefix)
if err := depStore.CreateTemplates(depMapping); err != nil {
return nil
Expand Down