Last active
February 24, 2022 14:38
-
-
Save TonPC64/2048cdef989d23805b5a32f059e10037 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// create server | |
mux := http.NewServeMux() | |
// wrapped handler for use propagation to extract trace signal from http header to request context | |
// it like a middleware | |
wrappedHandler := otelhttp.NewHandler(http.HandlerFunc(httpHandler), "http-server") | |
mux.Handle("/", wrappedHandler) | |
// start server | |
port := os.Getenv("PORT") | |
log.Debug().Msg("starting server at http://localhost:" + port) | |
if err := http.ListenAndServe(":"+port, mux); err != nil { | |
log.Panic().Err(err).Msg("server error") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment