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

remove default endpoints for jaeger trace exporter #281

Merged
merged 2 commits into from Nov 7, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions cmd/jaeger.go
Expand Up @@ -17,19 +17,21 @@ limitations under the License.
package cmd

import (
"errors"
"flag"
"go.opencensus.io/exporter/jaeger"
)

var options = jaeger.Options{
AgentEndpoint: "127.0.0.1:6831",
CollectorEndpoint: "127.0.0.1:14268",
AgentEndpoint: "",
CollectorEndpoint: "",
}
var ErrInvalidJaegerExporterEndpoint = errors.New("empty jaeger_agent_endpoint and jaeger_collector_endpoint")

// RegisterJaegerCmdParameters register cli parameters with flag for jaeger options
func RegisterJaegerCmdParameters() {
flag.StringVar(&options.AgentEndpoint, "jaeger_agent_endpoint", options.AgentEndpoint, "Jaeger agent endpoint that will be used to export trace data")
flag.StringVar(&options.CollectorEndpoint, "jaeger_collector_endpoint", options.CollectorEndpoint, "Jaeger endpoint that will be used to export trace data")
flag.StringVar(&options.AgentEndpoint, "jaeger_agent_endpoint", options.AgentEndpoint, "Jaeger agent endpoint (for example, localhost:6831) that will be used to export trace data")
flag.StringVar(&options.CollectorEndpoint, "jaeger_collector_endpoint", options.CollectorEndpoint, "Jaeger endpoint (for example, http://localhost:14268/api/traces) that will be used to export trace data")
flag.StringVar(&options.Username, "jaeger_basic_auth_username", "", "Username used for basic auth (optional) to jaeger")
flag.StringVar(&options.Password, "jaeger_basic_auth_password", "", "Password used for basic auth (optional) to jaeger")
}
Expand All @@ -38,3 +40,11 @@ func RegisterJaegerCmdParameters() {
func GetJaegerCmdParameters() jaeger.Options {
return options
}

// ValidateJaegerCmdParameters validate cli parameters
func ValidateJaegerCmdParameters() error {
if options.AgentEndpoint == "" && options.CollectorEndpoint == "" {
return ErrInvalidJaegerExporterEndpoint
}
return nil
}
4 changes: 4 additions & 0 deletions cmd/tracing.go
Expand Up @@ -50,6 +50,10 @@ func SetupTracing(serviceName string) {
trace.RegisterExporter(&logging.LogSpanExporter{})
}
if IsTraceToJaegerOn() {
if err := ValidateJaegerCmdParameters(); err != nil {
log.WithError(err).Errorln("Invalid jaeger parameters")
os.Exit(1)
}
jaegerOptions := GetJaegerCmdParameters()
jaegerOptions.ServiceName = serviceName
jaegerEndpoint, err := jaeger.NewExporter(jaegerOptions)
Expand Down
8 changes: 4 additions & 4 deletions configs/acra-connector.yaml
Expand Up @@ -67,17 +67,17 @@ incoming_connection_prometheus_metrics_string:
# Connection string like tcp://x.x.x.x:yyyy or unix:///path/to/socket
incoming_connection_string: tcp://127.0.0.1:9494/

# Jaeger agent endpoint that will be used to export trace data
jaeger_agent_endpoint: 127.0.0.1:6831
# Jaeger agent endpoint (for example, localhost:6831) that will be used to export trace data
jaeger_agent_endpoint:

# Password used for basic auth (optional) to jaeger
jaeger_basic_auth_password:

# Username used for basic auth (optional) to jaeger
jaeger_basic_auth_username:

# Jaeger endpoint that will be used to export trace data
jaeger_collector_endpoint: 127.0.0.1:14268
# Jaeger endpoint (for example, http://localhost:14268/api/traces) that will be used to export trace data
jaeger_collector_endpoint:

# Folder from which will be loaded keys
keys_dir: .acrakeys
Expand Down
8 changes: 4 additions & 4 deletions configs/acra-server.yaml
Expand Up @@ -64,17 +64,17 @@ incoming_connection_prometheus_metrics_string:
# Connection string like tcp://x.x.x.x:yyyy or unix:///path/to/socket
incoming_connection_string: tcp://0.0.0.0:9393/

# Jaeger agent endpoint that will be used to export trace data
jaeger_agent_endpoint: 127.0.0.1:6831
# Jaeger agent endpoint (for example, localhost:6831) that will be used to export trace data
jaeger_agent_endpoint:

# Password used for basic auth (optional) to jaeger
jaeger_basic_auth_password:

# Username used for basic auth (optional) to jaeger
jaeger_basic_auth_username:

# Jaeger endpoint that will be used to export trace data
jaeger_collector_endpoint: 127.0.0.1:14268
# Jaeger endpoint (for example, http://localhost:14268/api/traces) that will be used to export trace data
jaeger_collector_endpoint:

# Folder from which will be loaded keys
keys_dir: .acrakeys
Expand Down
8 changes: 4 additions & 4 deletions configs/acra-translator.yaml
Expand Up @@ -22,17 +22,17 @@ incoming_connection_http_string:
# URL which will be used to expose Prometheus metrics (use <URL>/metrics address to pull metrics)
incoming_connection_prometheus_metrics_string:

# Jaeger agent endpoint that will be used to export trace data
jaeger_agent_endpoint: 127.0.0.1:6831
# Jaeger agent endpoint (for example, localhost:6831) that will be used to export trace data
jaeger_agent_endpoint:

# Password used for basic auth (optional) to jaeger
jaeger_basic_auth_password:

# Username used for basic auth (optional) to jaeger
jaeger_basic_auth_username:

# Jaeger endpoint that will be used to export trace data
jaeger_collector_endpoint: 127.0.0.1:14268
# Jaeger endpoint (for example, http://localhost:14268/api/traces) that will be used to export trace data
jaeger_collector_endpoint:

# Folder from which will be loaded keys
keys_dir: .acrakeys
Expand Down