Skip to content
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

fix(tracer): fix tag setting on span #1208

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/services/api/AxiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,12 @@ const requestFormatter = async (axiosConfig: AxiosRequestConfig) => {
// NOTE: This also implies that the user has not provided
// their own github token and hence, are email login users.
const isEmailLoginUser = getIsEmailUserFromAuthMessage(authMessage)
const span = tracer.scope().active()

if (isEmailLoginUser) {
const accessToken = await tokenServiceInstance.getAccessToken()
if (accessToken.isOk()) {
tracer.use("http", {
hooks: {
request: (span, req, res) => {
span?.setTag("user.type", "email")
},
},
})
span?.setTag("user.type", "email")
const requestMethod = axiosConfig.method ?? "undefined method"
logger.info(
`Email login user made ${requestMethod} call to Github API: ${axiosConfig.url}`
Expand All @@ -71,13 +66,9 @@ const requestFormatter = async (axiosConfig: AxiosRequestConfig) => {
}
}
}
tracer.use("http", {
hooks: {
request: (span, req, res) => {
span?.setTag("user.type", "github")
},
},
})

span?.setTag("user.type", "github")

const requestMethod = axiosConfig.method ?? "undefined method"
logger.info(
`Github login user made ${requestMethod} call to Github API: ${axiosConfig.url}`
Expand Down
Loading