env.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright The OpenTelemetry Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger"
  15. import (
  16. "os"
  17. )
  18. // Environment variable names.
  19. const (
  20. // Hostname for the Jaeger agent, part of address where exporter sends spans
  21. // i.e. "localhost".
  22. envAgentHost = "OTEL_EXPORTER_JAEGER_AGENT_HOST"
  23. // Port for the Jaeger agent, part of address where exporter sends spans
  24. // i.e. 6831.
  25. envAgentPort = "OTEL_EXPORTER_JAEGER_AGENT_PORT"
  26. // The HTTP endpoint for sending spans directly to a collector,
  27. // i.e. http://jaeger-collector:14268/api/traces.
  28. envEndpoint = "OTEL_EXPORTER_JAEGER_ENDPOINT"
  29. // Username to send as part of "Basic" authentication to the collector endpoint.
  30. envUser = "OTEL_EXPORTER_JAEGER_USER"
  31. // Password to send as part of "Basic" authentication to the collector endpoint.
  32. envPassword = "OTEL_EXPORTER_JAEGER_PASSWORD"
  33. )
  34. // envOr returns an env variable's value if it is exists or the default if not.
  35. func envOr(key, defaultValue string) string {
  36. if v := os.Getenv(key); v != "" {
  37. return v
  38. }
  39. return defaultValue
  40. }