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

Ingester Main #952

Merged
merged 3 commits into from
Aug 1, 2018
Merged

Ingester Main #952

merged 3 commits into from
Aug 1, 2018

Conversation

davit-y
Copy link
Contributor

@davit-y davit-y commented Jul 24, 2018

Which problem is this PR solving?

Short description of the changes

  • Add options.go to configure ingester using viper
  • Add main.go to initialize and start Ingester

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #952 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #952   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         138    139    +1     
  Lines        6373   6400   +27     
=====================================
+ Hits         6373   6400   +27
Impacted Files Coverage Δ
cmd/ingester/app/flags.go 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c12a9e2...486beb0. Read the comment docs.

@davit-y davit-y force-pushed the ingester-main branch 8 times, most recently from 85a2a48 to 30117f3 Compare July 26, 2018 19:00

const (
configPrefix = "ingester"
suffixBrokers = ".brokers"
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm, I'm not sure about this. These configs shouldn't belong on the ingester itself, but should be encapsulated inside the storage factory. Do we have to do this like this since we haven't come up with a better story for the storage factory and flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked in person, but I'll recap for those who may be curious. Early in the design process there was a discussion about wether the Ingester should operate on an abstract queue or for Kafka. We decided it will be designed for kafka, but be independent of the write storage. Therefore there isn't an issue with having kafka specific config on the Ingester as long as the write storage is handled similarly to the other jaeger applications.

if err != nil {
logger.Fatal("Failed to create span writer", zap.Error(err))
}
unmarshaller := app.UnmarshallerFromType(options.Encoding)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can see us copy pasting a lot of this kafka initialization logic when we OSS the indexer (is that part of the plan btw). Do you think it'll make sense to create something like https://github.com/jaegertracing/jaeger/blob/master/pkg/cassandra/config/config.go to handle all the kafka bootstrapping rather than dumping it all here in main?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, let me rephrase a bit, internally, we don't want to write this same main logic if we can help it. Ideally, we create a builder for the ingester similar to the agent builder https://github.com/jaegertracing/jaeger/blob/master/cmd/agent/app/builder.go and internally, we can just run builder.build() instead of copy pasting this same code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@davit-y davit-y force-pushed the ingester-main branch 2 times, most recently from e22c22c to 60fc837 Compare July 27, 2018 15:39
encodingProto = "protobuf"

defaultBroker = "127.0.0.1:9092"
defaultTopic = "jaeger-ingester-spans"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the default topic used by the jaeger-collector's kafka writers to emit spans?

case <-signalsChannel:
err := kafkaConsumer.Close()
if err != nil {
logger.Error("Failed to close span writer", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does closing the consumer also close the span writer?

logger.Error("Failed to close span writer", zap.Error(err))
}
}
logger.Info("Jaeger Ingester is finishing")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd also add a log line on L101 stating "Beginning shutdown of Jaeger Ingester" or something similar.

@davit-y davit-y changed the title Ingester Main [WIP] Ingester Main Jul 30, 2018
@davit-y davit-y changed the title [WIP] Ingester Main Ingester Main Jul 30, 2018
@davit-y davit-y changed the title Ingester Main [WIP] Ingester Main Jul 30, 2018
@davit-y davit-y changed the title [WIP] Ingester Main Ingester Main Jul 30, 2018
@davit-y
Copy link
Contributor Author

davit-y commented Jul 30, 2018

Redoing using a builder to allow for easy initialization of an ingester

Signed-off-by: Davit Yeghshatyan <davo@uber.com>
// DefaultParallelism is the default parallelism for the span processor
DefaultParallelism = 1000
// DefaultEncoding is the default span encoding
DefaultEncoding = EncodingJSON
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious, is this what we emit from the collectors? (Not protobuf?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, default should be protobuf

var unmarshaller kafka.Unmarshaller
if b.Encoding == EncodingJSON {
unmarshaller = kafka.NewJSONUnmarshaller()
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of this approach because if someone passes in an arbitrary encoding, they would get a protobuf marshaller. I recommend checking for the type and returning an error if nothing matches.

Signed-off-by: Davit Yeghshatyan <davo@uber.com>
Signed-off-by: Davit Yeghshatyan <davo@uber.com>
@black-adder black-adder merged commit 44532d0 into jaegertracing:master Aug 1, 2018
isaachier pushed a commit to isaachier/jaeger that referenced this pull request Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants