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 Cassandra OTEL exporter #2139

Merged
merged 2 commits into from
Mar 27, 2020
Merged

Conversation

pavolloffay
Copy link
Member

Depdens on #2135

Signed-off-by: Pavol Loffay ploffay@redhat.com

@pavolloffay pavolloffay requested a review from a team as a code owner March 24, 2020 17:37
@pavolloffay pavolloffay requested a review from jpkrohling March 24, 2020 17:37
@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

Merging #2139 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2139      +/-   ##
==========================================
- Coverage   96.15%   96.14%   -0.02%     
==========================================
  Files         218      218              
  Lines       10567    10572       +5     
==========================================
+ Hits        10161    10164       +3     
  Misses        352      352              
- Partials       54       56       +2
Impacted Files Coverage Δ
plugin/storage/cassandra/options.go 100% <100%> (ø) ⬆️
plugin/storage/cassandra/factory.go 100% <100%> (ø) ⬆️
cmd/query/app/static_handler.go 86.84% <0%> (-1.76%) ⬇️
plugin/storage/badger/spanstore/reader.go 96.79% <0%> (ø) ⬆️

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 e124801...a691255. Read the comment docs.

@pavolloffay pavolloffay changed the title WIP: Add Cassandra OTEL exporter Add Cassandra OTEL exporter Mar 25, 2020
@pavolloffay pavolloffay requested review from objectiser and removed request for jpkrohling March 25, 2020 13:42
@pavolloffay pavolloffay reopened this Mar 25, 2020
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Copy link
Member

@annanay25 annanay25 left a comment

Choose a reason for hiding this comment

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

LGTM! I love the design of the exporter.


cassandraFactory := factories.Exporters[cassandra.TypeStr]
cc := cassandraFactory.CreateDefaultConfig().(*cassandra.Config)
assert.Equal(t, []string{"127.0.0.1"}, cc.Options.GetPrimary().Servers)
Copy link
Member

Choose a reason for hiding this comment

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

No harm in testing again, but default values are tested in cmd/opentelemetry-collector/app/exporter/cassandra/config_test.go

Copy link
Member Author

Choose a reason for hiding this comment

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

Double-check that the default values have been applied. I will consider changing defaults interface to include cobra command and install Jaeger flags by default.

Index IndexConfig `mapstructure:"index"`
}

// IndexConfig configures indexing.
Copy link
Member

Choose a reason for hiding this comment

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

Nice!


// Factory is the factory for Jaeger Cassandra exporter.
type Factory struct {
OptionsFactory OptionsFactory
Copy link
Member

Choose a reason for hiding this comment

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

in what scenarios does this need to be a function instead of a struct?

Copy link
Member Author

@pavolloffay pavolloffay Mar 27, 2020

Choose a reason for hiding this comment

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

We need to initialize the Options struct with wiper once the collector service has started.

We can revisit this and instead pass a viper instance and run the initialization in CreateDefaultConfig.

}

// CreateDefaultConfig returns default configuration of Factory.
func (f Factory) CreateDefaultConfig() configmodels.Exporter {
Copy link
Member

Choose a reason for hiding this comment

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

Is the name CreateDefaultConfig required by some external API? We usually mention it in the comment.

Given that the result of this function depends on externally provided (via OptionsFactory) options, the name "default" is confusing.

Copy link
Member

Choose a reason for hiding this comment

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

CreateDefaultConfig() is part of the extension.Factory interface in the Otel collector. I agree that "default" is confusing here, we should ideally apply user supplied options once the default config is created

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 agree that "default" is confusing here, we should ideally apply user supplied options once the default config is created

OTEL service applies config file changes to the returned instance. We cannot override them by config supplied as legacy jaeger flags. The OTEL config takes precedence over legacy jaeger configuration.

import (
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"

"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
Copy link
Member

Choose a reason for hiding this comment

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

Also we should consider naming this import storageCassandra. Less confusing and also consistent with other files where it has been imported

Copy link
Member Author

Choose a reason for hiding this comment

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

It is only in one file, where there is a conflict in imports.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

@yurishkuro I will merge this, feel free to comment and I will fix issues in follow up PR.

@pavolloffay pavolloffay merged commit 5e06df7 into jaegertracing:master Mar 27, 2020
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.

3 participants