Skip to content

Commit 70fc074

Browse files
committed
docs: fixes rideshare example
1 parent fbd1561 commit 70fc074

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

examples/golang-push/rideshare/main.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ func index(w http.ResponseWriter, r *http.Request) {
4747

4848
func main() {
4949
config := rideshare.ReadConfig()
50-
config.AppName = os.Getenv("PYROSCOPE_APPLICATION_NAME")
51-
if config.AppName == "" {
52-
config.AppName = "ride-sharing-app"
53-
}
54-
hostname, err := os.Hostname()
55-
if err == nil {
56-
config.Tags = map[string]string{
57-
"hostname": hostname,
58-
}
59-
}
6050

6151
tp, _ := setupOTEL(config)
6252
defer func() {

examples/golang-push/rideshare/rideshare/rideshare.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,16 @@ type Config struct {
7676
}
7777

7878
func ReadConfig() Config {
79+
appName := os.Getenv("PYROSCOPE_APPLICATION_NAME")
80+
if appName == "" {
81+
appName = "ride-sharing-app"
82+
}
83+
hostname, err := os.Hostname()
84+
if err != nil {
85+
hostname = "unknown"
86+
}
7987
c := Config{
80-
AppName: os.Getenv("PYROSCOPE_APPLICATION_NAME"),
88+
AppName: appName,
8189
PyroscopeServerAddress: os.Getenv("PYROSCOPE_SERVER_ADDRESS"),
8290
PyroscopeBasicAuthUser: os.Getenv("PYROSCOPE_BASIC_AUTH_USER"),
8391
PyroscopeBasicAuthPassword: os.Getenv("PYROSCOPE_BASIC_AUTH_PASSWORD"),
@@ -91,7 +99,8 @@ func ReadConfig() Config {
9199
UseDebugTracer: os.Getenv("DEBUG_TRACER") == "1",
92100
UseDebugLogger: os.Getenv("DEBUG_LOGGER") == "1",
93101
Tags: map[string]string{
94-
"region": os.Getenv("REGION"),
102+
"region": os.Getenv("REGION"),
103+
"hostname": hostname,
95104
},
96105

97106
ParametersPoolSize: envIntOrDefault("PARAMETERS_POOL_SIZE", 1000),

0 commit comments

Comments
 (0)