Skip to content

Commit

Permalink
fix trace name for indexHPP and add some prospective logging
Browse files Browse the repository at this point in the history
  • Loading branch information
macrael committed Nov 6, 2023
1 parent 29f1e35 commit 2d9af21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion services/app-api/src/resolvers/attributeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export function setResolverDetailsOnActiveSpan(
user: Context['user'],
span: Context['span']
): void {
if (!span) return
if (!span) {
console.info(`No span set on ${name} call`)
return
}
span.setAttributes({
[SemanticAttributes.ENDUSER_ID]: user.email,
[SemanticAttributes.ENDUSER_ROLE]: user.role,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export function indexHealthPlanPackagesResolver(
): QueryResolvers['indexHealthPlanPackages'] {
return async (_parent, _args, context) => {
const { user, span } = context
setResolverDetailsOnActiveSpan('fetchHealthPlanPackage', user, span)

setResolverDetailsOnActiveSpan('indexHealthPlanPackages', user, span)

const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag(
context,
Expand All @@ -70,7 +71,7 @@ export function indexHealthPlanPackagesResolver(

if (contractsWithHistory instanceof Error) {
const errMessage = `Issue finding contracts with history by stateCode: ${user.stateCode}. Message: ${contractsWithHistory.message}`
logError('fetchHealthPlanPackage', errMessage)
logError('indexHealthPlanPackages', errMessage)
setErrorAttributesOnActiveSpan(errMessage, span)

if (contractsWithHistory instanceof NotFoundError) {
Expand Down Expand Up @@ -111,7 +112,7 @@ export function indexHealthPlanPackagesResolver(

if (contractsWithHistory instanceof Error) {
const errMessage = `Issue finding contracts with history by submit info. Message: ${contractsWithHistory.message}`
logError('fetchHealthPlanPackage', errMessage)
logError('indexHealthPlanPackages', errMessage)
setErrorAttributesOnActiveSpan(errMessage, span)

if (contractsWithHistory instanceof NotFoundError) {
Expand Down

0 comments on commit 2d9af21

Please sign in to comment.