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] Add metrics& healthcheck, rename Kafka cli flags #1094

Merged
merged 4 commits into from
Nov 2, 2018

Conversation

ledor473
Copy link
Member

@ledor473 ledor473 commented Sep 28, 2018

Which problem is this PR solving?

Resolves #1014
Resolves #1013
Resolves #1093

Short description of the changes

  • Add default healthcheck port (14270)
  • Add a configurable metrics HTTP handler (default port is 14271)
  • Make Kafka flags the same as in the Collector (prefix is kafka instead of ingester)

Comments:

I wasn't sure if I should have refactor the following:

  • Move the various Kafka flags under /pkg
  • I left it as is mainly because there's a mix of consumer vs producer flags and because the producer flags are under plugins

Also, should the Parallelism be under Kafka prefix? I felt it was more a ingester flags than a kafka one, but I don't have any strong opinion about it

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

lgtm

cmd/ingester/app/flags.go Outdated Show resolved Hide resolved
@@ -33,6 +33,8 @@ const (

// ConfigPrefix is a prefix fro the ingester flags
Copy link
Member

Choose a reason for hiding this comment

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

s/fro/for/

@@ -54,27 +58,33 @@ const (
DefaultParallelism = 1000
// DefaultEncoding is the default span encoding
DefaultEncoding = EncodingProto
// DefaultHTTPPort is the default HTTP port
Copy link
Member

Choose a reason for hiding this comment

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

add: "e.g. for /metrics" (I was at first confused why we need http port)

@ledor473
Copy link
Member Author

ledor473 commented Oct 3, 2018

I'm not sure what would be the best way to fix that problem in the CI. The flags is indeed redefined, but they usually run in different Go applications

--- FAIL: TestKafkaStorage (0.00s)
panic: flag redefined: kafka.brokers [recovered]
	panic: flag redefined: kafka.brokers

I've also fixed the Ingester flag tests and moved ingester.encoding to kafka.encoding because it's like that in Collector

@yurishkuro
Copy link
Member

The flags is indeed redefined, but they usually run in different Go applications

This sounds like an issue with the tests. We should be able to create a new instance of the FlagSet in the unit test instead of depending on the global one.

@@ -48,7 +48,7 @@ func (s *KafkaIntegrationTestSuite) initialize() error {
topic := "jaeger-kafka-integration-test-" + strconv.FormatInt(time.Now().UnixNano(), 10)

f := kafka.NewFactory()
v, command := config.Viperize(f.AddFlags, app.AddFlags)
v, command := config.Viperize(app.AddFlags)
Copy link
Member Author

Choose a reason for hiding this comment

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

@yurishkuro the change here fixed the test. app.AddFlags already contained all flags needed by f.InitFromViper(v)

Copy link
Member

@yurishkuro yurishkuro Oct 30, 2018

Choose a reason for hiding this comment

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

is kafka factory's AddFlags() no-op then? looks a bit odd

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's because we are reusing the github.com/jaegertracing/jaeger/plugin/storage/kafka in a context it wasn't meant to be used. Ingester itself doesn't use the Kafka as a storage plugin, but rather as an input

@codecov
Copy link

codecov bot commented Oct 22, 2018

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1094   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         144     144           
  Lines        6774    6779    +5     
======================================
+ Hits         6774    6779    +5
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 2be7b0f...f466b0a. Read the comment docs.

@jpkrohling
Copy link
Contributor

@ledor473 do you still have anything to work here, or can I merge it ?

@ledor473
Copy link
Member Author

@jpkrohling It's ready to merge! I'll rebase it real quick

@yurishkuro yurishkuro changed the title Ingester improvements [ingester] Add metrics& healthcheck, rename Kafka cli flags Oct 30, 2018
@jpkrohling
Copy link
Contributor

Once codecov turns green, this will be merged.

@yurishkuro
Copy link
Member

I restarted test coverage job

@ghost ghost assigned yurishkuro Oct 30, 2018
@ghost ghost added the review label Oct 30, 2018
// DefaultHTTPPort is the default HTTP port (e.g. for /metrics)
DefaultHTTPPort = 14271
// IngesterDefaultHealthCheckHTTPPort is the default HTTP Port for health check
IngesterDefaultHealthCheckHTTPPort = 14270
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Does this need to have the Ingester prefix - as the other constants don't?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've taken the variable names from here and both are prefixed:

QueryDefaultHealthCheckHTTPPort = 16687

CollectorDefaultHealthCheckHTTPPort = 14269

That being said, there's a prefix on the other variable as well

ConfigPrefix = "ingester"
// KafkaConfigPrefix is a prefix for the ingester flags
Copy link
Contributor

Choose a reason for hiding this comment

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

"for the Kafka flags"

Copy link
Member Author

Choose a reason for hiding this comment

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

True!

cmd/ingester/app/flags.go Show resolved Hide resolved
@pavolloffay
Copy link
Member

@ledor473 could you please fix DCO of the last commit? I will merge afterwards.

@yurishkuro
Copy link
Member

@ledor473 could you please fix DCO of the last commit? I will merge afterwards.

it's a merge issue, unrelated commits got pulled in.

Louis-Etienne Dorval added 3 commits November 1, 2018 15:24
…tp handler and make Kafka flags the same as in the Collector

Signed-off-by: Louis-Etienne Dorval <[email protected]>
Signed-off-by: Louis-Etienne Dorval <[email protected]>
Signed-off-by: Louis-Etienne Dorval <[email protected]>
Signed-off-by: Louis-Etienne Dorval <[email protected]>
@ledor473
Copy link
Member Author

ledor473 commented Nov 1, 2018

My fault! Should be fixed now

@pavolloffay pavolloffay merged commit 44a969d into jaegertracing:master Nov 2, 2018
@ghost ghost removed the review label Nov 2, 2018
@pavolloffay
Copy link
Member

thanks @ledor473

@yurishkuro yurishkuro added this to the 1.8 Release milestone Nov 9, 2018
@ledor473
Copy link
Member Author

ledor473 commented Nov 15, 2018

@yurishkuro @pavolloffay @objectiser I've just realized that if you run the Ingester with SPAN_STORAGE_TYPE=elasticsearch,kafka, the Ingester crash with the following:

WARNING: multiple span storage types have been specified. Only the first type (elasticsearch) will be used for reading and archiving.

flag redefined: kafka.brokers
panic: flag redefined: kafka.brokers

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc000080d80, 0xefd9a0, 0xc00018d080, 0xe04f6e, 0xd, 0xe2cb58, 0x4b)
	/home/travis/.gimme/versions/go1.11.1.linux.amd64/src/flag/flag.go:805 +0x529
flag.(*FlagSet).StringVar(0xc000080d80, 0xc00018d080, 0xe04f6e, 0xd, 0xe05426, 0xe, 0xe2cb58, 0x4b)
	/home/travis/.gimme/versions/go1.11.1.linux.amd64/src/flag/flag.go:708 +0x8a
flag.(*FlagSet).String(0xc000080d80, 0xe04f6e, 0xd, 0xe05426, 0xe, 0xe2cb58, 0x4b, 0xe00e66)
	/home/travis/.gimme/versions/go1.11.1.linux.amd64/src/flag/flag.go:721 +0x8b
github.com/jaegertracing/jaeger/cmd/ingester/app.AddFlags(0xc000080d80)
	/home/travis/gopath/src/github.com/jaegertracing/jaeger/cmd/ingester/app/flags.go:84 +0x6e
github.com/jaegertracing/jaeger/pkg/config.AddFlags(0xc00015a0f0, 0xc000186240, 0xc000159f28, 0x5, 0x5, 0xc00003a042, 0xd)
	/home/travis/gopath/src/github.com/jaegertracing/jaeger/pkg/config/config.go:36 +0x56
main.main()
	/home/travis/gopath/src/github.com/jaegertracing/jaeger/cmd/ingester/main.go:138 +0x59f

I'm not sure how, but I feel we should add a validation on the storage type to prevent the use to KAFKA in the Ingester. Unless we want to support Kafka -> Kafka with the Ingester, but that feels wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants