tracing: better span names
This commit is contained in:
@@ -148,6 +148,8 @@ func getCity(req *http.Request) (*geoip2.City, error) {
|
||||
}
|
||||
|
||||
func handleJSON(w http.ResponseWriter, req *http.Request) {
|
||||
span := trace.SpanFromContext(req.Context())
|
||||
span.SetName("/api/json")
|
||||
city, err := getCity(req)
|
||||
if err != nil {
|
||||
log.Printf("getCity error: %s", err)
|
||||
@@ -166,6 +168,9 @@ func handleJSON(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
func handleCountry(w http.ResponseWriter, req *http.Request) {
|
||||
span := trace.SpanFromContext(req.Context())
|
||||
span.SetName("/api/country")
|
||||
|
||||
city, err := getCity(req)
|
||||
if err != nil {
|
||||
log.Printf("getCity error: %s", err)
|
||||
@@ -178,6 +183,10 @@ func handleCountry(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
func handleHealth(w http.ResponseWriter, req *http.Request) {
|
||||
span := trace.SpanFromContext(req.Context())
|
||||
span.SetAttributes(attribute.Bool("app.drop_sample", true))
|
||||
span.SetName("/healthz")
|
||||
|
||||
ip := net.ParseIP("199.43.0.43")
|
||||
city, err := getCityIP(ip)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user