env.go (1628B)
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 15 package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" 16 17 import ( 18 "os" 19 ) 20 21 // Environment variable names. 22 const ( 23 // Hostname for the Jaeger agent, part of address where exporter sends spans 24 // i.e. "localhost". 25 envAgentHost = "OTEL_EXPORTER_JAEGER_AGENT_HOST" 26 // Port for the Jaeger agent, part of address where exporter sends spans 27 // i.e. 6831. 28 envAgentPort = "OTEL_EXPORTER_JAEGER_AGENT_PORT" 29 // The HTTP endpoint for sending spans directly to a collector, 30 // i.e. http://jaeger-collector:14268/api/traces. 31 envEndpoint = "OTEL_EXPORTER_JAEGER_ENDPOINT" 32 // Username to send as part of "Basic" authentication to the collector endpoint. 33 envUser = "OTEL_EXPORTER_JAEGER_USER" 34 // Password to send as part of "Basic" authentication to the collector endpoint. 35 envPassword = "OTEL_EXPORTER_JAEGER_PASSWORD" 36 ) 37 38 // envOr returns an env variable's value if it is exists or the default if not. 39 func envOr(key, defaultValue string) string { 40 if v := os.Getenv(key); v != "" { 41 return v 42 } 43 return defaultValue 44 }