-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 jaeger grpc exporter #219
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package jaegerexporter | ||
package jaeger | ||
|
||
import ( | ||
"context" | ||
|
@@ -26,28 +26,28 @@ import ( | |
jaegertranslator "github.com/open-telemetry/opentelemetry-service/translator/trace/jaeger" | ||
) | ||
|
||
// JaegerThriftTChannelSender takes span batches and sends them | ||
// ThriftTChannelSender takes span batches and sends them | ||
// out on tchannel in thrift encoding | ||
type JaegerThriftTChannelSender struct { | ||
type ThriftTChannelSender struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to pass lint. |
||
logger *zap.Logger | ||
reporter reporter.Reporter | ||
} | ||
|
||
var _ consumer.TraceConsumer = (*JaegerThriftTChannelSender)(nil) | ||
var _ consumer.TraceConsumer = (*ThriftTChannelSender)(nil) | ||
|
||
// NewJaegerThriftTChannelSender creates new TChannel-based sender. | ||
func NewJaegerThriftTChannelSender( | ||
reporter reporter.Reporter, | ||
zlogger *zap.Logger, | ||
) *JaegerThriftTChannelSender { | ||
return &JaegerThriftTChannelSender{ | ||
) *ThriftTChannelSender { | ||
return &ThriftTChannelSender{ | ||
logger: zlogger, | ||
reporter: reporter, | ||
} | ||
} | ||
|
||
// ConsumeTraceData sends the received data to the configured Jaeger Thrift end-point. | ||
func (s *JaegerThriftTChannelSender) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error { | ||
func (s *ThriftTChannelSender) ConsumeTraceData(ctx context.Context, td consumerdata.TraceData) error { | ||
// TODO: (@pjanotti) In case of failure the translation to Jaeger Thrift is going to be remade, cache it somehow. | ||
tBatch, err := jaegertranslator.OCProtoToJaegerThrift(td) | ||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2019, OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package jaegergrpcexporter | ||
|
||
import ( | ||
"github.com/open-telemetry/opentelemetry-service/config/configmodels" | ||
) | ||
|
||
// Config defines configuration for Jaeger gRPC exporter. | ||
type Config struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we leave a TODO for TLS option in the config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I will create an issues to track not TLS but also other missing configurations: timeout, headers, and so on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually there is already one issue to TLS to jaeger receiver and exporter: #126 |
||
configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. | ||
Endpoint string `mapstructure:"endpoint"` | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2019, OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package jaegergrpcexporter | ||
|
||
import ( | ||
"path" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap" | ||
|
||
"github.com/open-telemetry/opentelemetry-service/config" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import ordering. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
) | ||
|
||
func TestLoadConfig(t *testing.T) { | ||
receivers, processors, exporters, err := config.ExampleComponents() | ||
assert.Nil(t, err) | ||
|
||
factory := &Factory{} | ||
exporters[typeStr] = factory | ||
cfg, err := config.LoadConfigFile( | ||
t, path.Join(".", "testdata", "config.yaml"), receivers, processors, exporters, | ||
) | ||
|
||
require.NoError(t, err) | ||
require.NotNil(t, cfg) | ||
|
||
e0 := cfg.Exporters["jaeger-grpc"] | ||
|
||
// Endpoint doesn't have a default value so set it directly. | ||
defaultCfg := factory.CreateDefaultConfig().(*Config) | ||
defaultCfg.Endpoint = "some.target:55678" | ||
assert.Equal(t, defaultCfg, e0) | ||
|
||
e1 := cfg.Exporters["jaeger-grpc/2"] | ||
assert.Equal(t, "jaeger-grpc/2", e1.(*Config).Name()) | ||
assert.Equal(t, "a.new.target:1234", e1.(*Config).Endpoint) | ||
_, _, err = factory.CreateTraceExporter(zap.NewNop(), e1) | ||
require.NoError(t, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to pass lint.