-
Notifications
You must be signed in to change notification settings - Fork 2k
Add jaeger thrift-http exporter #228
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
Merged
pjanotti
merged 1 commit into
open-telemetry:master
from
pjanotti:add-jaeger-thrift-http-exporter
Aug 5, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // 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 jaegerthrifthttpexporter | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| "github.com/open-telemetry/opentelemetry-service/config/configmodels" | ||
| ) | ||
|
|
||
| // Config defines configuration for Jaeger Thrift over HTTP exporter. | ||
| type Config struct { | ||
| configmodels.ExporterSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. | ||
|
|
||
| // URL is the URL to send the Jaeger trace data to (e.g.: | ||
| // http://some.url:14268/api/traces). | ||
| URL string `mapstructure:"url"` | ||
|
|
||
| // Timeout is the maximum timeout for HTTP request sending trace data. The | ||
| // default value is 5 seconds. | ||
| Timeout time.Duration `mapstructure:"timeout"` | ||
|
|
||
| // Headers are a set of headers to be added to the HTTP request sending | ||
| // trace data. | ||
| Headers map[string]string `mapstructure:"headers"` | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // 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 jaegerthrifthttpexporter | ||
|
|
||
| import ( | ||
| "path" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "go.uber.org/zap" | ||
|
|
||
| "github.com/open-telemetry/opentelemetry-service/config" | ||
| "github.com/open-telemetry/opentelemetry-service/config/configmodels" | ||
| ) | ||
|
|
||
| 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-thrift-http"] | ||
|
|
||
| // URL doesn't have a default value so set it directly. | ||
| defaultCfg := factory.CreateDefaultConfig().(*Config) | ||
| defaultCfg.URL = "http://some.location:14268/api/traces" | ||
| assert.Equal(t, defaultCfg, e0) | ||
|
|
||
| expectedName := "jaeger-thrift-http/2" | ||
|
|
||
| e1 := cfg.Exporters[expectedName] | ||
| expectedCfg := Config{ | ||
| ExporterSettings: configmodels.ExporterSettings{ | ||
| TypeVal: typeStr, | ||
| NameVal: expectedName, | ||
| }, | ||
| URL: "http://some.other.location/api/traces", | ||
| Headers: map[string]string{ | ||
| "added-entry": "added value", | ||
| "dot.test": "test", | ||
| }, | ||
| Timeout: 2 * time.Second, | ||
| } | ||
| assert.Equal(t, &expectedCfg, e1) | ||
|
|
||
| _, _, err = factory.CreateTraceExporter(zap.NewNop(), e1) | ||
| require.NoError(t, err) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: can we use
endpointto be consistent with other configs?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.
We have been consistent on endpoint for receivers because they should always take the same syntax (host:port) but for exporters we had a different conversation in one previous PR: #207 (comment) let's know if you agree with that.
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.
SGTM