-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add X-Goog-Api-Client
metric header to outgoing requests
#655
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,9 @@ import ( | |
"io/ioutil" | ||
"math" | ||
"net/http" | ||
"runtime" | ||
"strconv" | ||
"strings" | ||
"time" | ||
|
||
"google.golang.org/api/option" | ||
|
@@ -441,3 +443,9 @@ func retryNetworkAndHTTPErrors(statusCodes ...int) RetryCondition { | |
return false | ||
} | ||
} | ||
|
||
// GetMetricsHeader constructs header value for metrics attribution | ||
func GetMetricsHeader(sdkVersion string) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to access the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not possible, that would cause a dependency cycle. I'm not a fan of how this is structured either. I would prefer if we kept the Version value separately from firebase.go. |
||
goVersion := strings.TrimPrefix(runtime.Version(), "go") | ||
return fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, sdkVersion) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only way to pass headers here is to pass it through a request factory. This is a little more involved, should I separate this change into it's own PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this request is just for the key server (we might not track the requests there anyways) let's skip it for now then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good