File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed
examples/golang-push/rideshare Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -47,16 +47,6 @@ func index(w http.ResponseWriter, r *http.Request) {
47
47
48
48
func main () {
49
49
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
- }
60
50
61
51
tp , _ := setupOTEL (config )
62
52
defer func () {
Original file line number Diff line number Diff line change @@ -76,8 +76,16 @@ type Config struct {
76
76
}
77
77
78
78
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
+ }
79
87
c := Config {
80
- AppName : os . Getenv ( "PYROSCOPE_APPLICATION_NAME" ) ,
88
+ AppName : appName ,
81
89
PyroscopeServerAddress : os .Getenv ("PYROSCOPE_SERVER_ADDRESS" ),
82
90
PyroscopeBasicAuthUser : os .Getenv ("PYROSCOPE_BASIC_AUTH_USER" ),
83
91
PyroscopeBasicAuthPassword : os .Getenv ("PYROSCOPE_BASIC_AUTH_PASSWORD" ),
@@ -91,7 +99,8 @@ func ReadConfig() Config {
91
99
UseDebugTracer : os .Getenv ("DEBUG_TRACER" ) == "1" ,
92
100
UseDebugLogger : os .Getenv ("DEBUG_LOGGER" ) == "1" ,
93
101
Tags : map [string ]string {
94
- "region" : os .Getenv ("REGION" ),
102
+ "region" : os .Getenv ("REGION" ),
103
+ "hostname" : hostname ,
95
104
},
96
105
97
106
ParametersPoolSize : envIntOrDefault ("PARAMETERS_POOL_SIZE" , 1000 ),
You can’t perform that action at this time.
0 commit comments