Skip to content

Commit

Permalink
feat: Adding the default port :4317 only if there aren't port (#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
yodigos authored Sep 26, 2024
1 parent 1f72de6 commit 5a4f8e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/config/tempo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package config
import (
"errors"
"fmt"
"regexp"
"strings"

"github.com/odigos-io/odigos/common"
Expand All @@ -12,6 +13,8 @@ const (
tempoUrlKey = "TEMPO_URL"
)

var urlPortExistRegex = regexp.MustCompile(`:\d+`)

type Tempo struct{}

func (t *Tempo) DestType() common.DestinationType {
Expand All @@ -31,11 +34,15 @@ func (t *Tempo) ModifyConfig(dest ExporterConfigurer, currentConfig *Config) err

if isTracingEnabled(dest) {
url = strings.TrimPrefix(url, "http://")
url = strings.TrimSuffix(url, ":4317")
endpoint := url

if !urlPortExistRegex.MatchString(url) {
endpoint = fmt.Sprintf("%s:4317", url)
}

tempoExporterName := "otlp/tempo-" + dest.GetID()
currentConfig.Exporters[tempoExporterName] = GenericMap{
"endpoint": fmt.Sprintf("%s:4317", url),
"endpoint": endpoint,
"tls": GenericMap{
"insecure": true,
},
Expand Down

0 comments on commit 5a4f8e3

Please sign in to comment.