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 OTLP HTPP exporter support #683

Merged
merged 1 commit into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- [FEATURE] Add TLS config options for tempo `remote_write`s. (@mapno)

- [FEATURE] Add support for OTLP HTTP trace exporting. (@mapno)

- [ENHANCEMENT] The Grafana Agent Operator will now default to deploying
the matching release version of the Grafana Agent instead of v0.14.0.
(@rfratto)
Expand Down
4 changes: 4 additions & 0 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,10 @@ remote_write:

# Controls whether compression is enabled.
[ compression: <string> | default = "gzip" | supported = "none", "gzip"]

# Controls what protocol to use when exporting traces.
# Only "grpc" is supported in Grafana Cloud.
[ protocol: <string> | default = "grpc" | supported = "grpc", "http" ]

# Controls whether or not TLS is required. See https://godoc.org/google.golang.org/grpc#WithInsecure
[ insecure: <boolean> | default = false ]
Expand Down
14 changes: 13 additions & 1 deletion pkg/tempo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/exporter/otlpexporter"
"go.opentelemetry.io/collector/exporter/otlphttpexporter"
"go.opentelemetry.io/collector/exporter/prometheusexporter"
"go.opentelemetry.io/collector/processor/attributesprocessor"
"go.opentelemetry.io/collector/processor/batchprocessor"
Expand Down Expand Up @@ -137,6 +138,8 @@ type InstanceConfig struct {
const (
compressionNone = "none"
compressionGzip = "gzip"
protocolGRPC = "grpc"
protocolHTTP = "http"
)

// DefaultPushConfig holds the default settings for a PushConfig.
Expand Down Expand Up @@ -174,12 +177,14 @@ func (c *PushConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
// DefaultRemoteWriteConfig holds the default settings for a PushConfig.
var DefaultRemoteWriteConfig = RemoteWriteConfig{
Compression: compressionGzip,
Protocol: protocolGRPC,
}

// RemoteWriteConfig controls the configuration of an exporter
type RemoteWriteConfig struct {
Endpoint string `yaml:"endpoint,omitempty"`
Compression string `yaml:"compression,omitempty"`
Protocol string `yaml:"protocol,omitempty"`
Insecure bool `yaml:"insecure,omitempty"`
// Deprecated
InsecureSkipVerify bool `yaml:"insecure_skip_verify,omitempty"`
Expand Down Expand Up @@ -341,7 +346,13 @@ func (c *InstanceConfig) exporters() (map[string]interface{}, error) {
if err != nil {
return nil, err
}
exporterName := fmt.Sprintf("otlp/%d", i)
var exporterName string
switch remoteWriteConfig.Protocol {
case protocolGRPC:
exporterName = fmt.Sprintf("otlp/%d", i)
case protocolHTTP:
exporterName = fmt.Sprintf("otlphttp/%d", i)
}
exporters[exporterName] = exporter
}
return exporters, nil
Expand Down Expand Up @@ -637,6 +648,7 @@ func tracingFactories() (component.Factories, error) {

exporters, err := component.MakeExporterFactoryMap(
otlpexporter.NewFactory(),
otlphttpexporter.NewFactory(),
loadbalancingexporter.NewFactory(),
prometheusexporter.NewFactory(),
remotewriteexporter.NewFactory(),
Expand Down
37 changes: 37 additions & 0 deletions pkg/tempo/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,43 @@ service:
exporters: ["otlp/0"]
processors: []
receivers: ["jaeger"]
`,
},
{
name: "otlp http & grpc exporters",
cfg: `
receivers:
jaeger:
protocols:
grpc:
remote_write:
- endpoint: example.com:12345
protocol: http
- endpoint: example.com:12345
protocol: grpc
`,
expectedConfig: `
receivers:
jaeger:
protocols:
grpc:
exporters:
otlphttp/0:
endpoint: example.com:12345
compression: gzip
retry_on_failure:
max_elapsed_time: 60s
otlp/1:
endpoint: example.com:12345
compression: gzip
retry_on_failure:
max_elapsed_time: 60s
service:
pipelines:
traces:
exporters: ["otlphttp/0", "otlp/1"]
processors: []
receivers: ["jaeger"]
`,
},
}
Expand Down