Skip to content

Commit

Permalink
Resolved segment event issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ArpitShukla12 committed Nov 8, 2023
1 parent 31e0aa9 commit 8ff1a35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
9 changes: 3 additions & 6 deletions adapters/api/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,27 @@ export async function sendSegmentEvent(action, body) {
authorization: `Bearer ${ATLAN_API_TOKEN}`,
"content-type": "application/json",
};
console.log("MyHeaders :", myHeaders);

const requestOptions = {
method: "POST",
headers: myHeaders,
body: body,
};
console.log("requestOptions :", requestOptions);

var response = null;
console.log("IS_DEV", IS_DEV);

if (!IS_DEV) {
response = await fetch(
`${ATLAN_INSTANCE_URL}/api/service/segment/track`,
requestOptions
)
.then((resp) => {
console.log("Inside then", resp);
console.log("send segment event", action, body);
})
.catch((err) => {
console.log("Catch err", err);
console.log("couldn't send segment event", err);
});
} else {
console.log("Wuttt");
console.log("send segment event", action, body);
}

Expand Down
3 changes: 1 addition & 2 deletions adapters/integrations/github-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default class GitHubIntegration extends IntegrationInterface {
}

if (total_assets !== 0) {
console.log("Checking");
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down Expand Up @@ -863,7 +862,7 @@ ${content}`;
headSHA,
"createIssueComment"
);
console.log(content);

return content;
}

Expand Down
3 changes: 1 addition & 2 deletions adapters/integrations/gitlab-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,7 @@ ${content}`;
domain,
},
});
console.log("Action :", action);
console.log("raw", raw);

return sendSegmentEvent(action, raw);
} catch (error) {
logger.withError(
Expand Down
15 changes: 5 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25379,30 +25379,27 @@ async function sendSegmentEvent(action, body) {
authorization: `Bearer ${ATLAN_API_TOKEN}`,
"content-type": "application/json",
};
console.log("MyHeaders :", myHeaders);

const requestOptions = {
method: "POST",
headers: myHeaders,
body: body,
};
console.log("requestOptions :", requestOptions);

var response = null;
console.log("IS_DEV", IS_DEV);

if (!IS_DEV) {
response = await src_fetch(
`${ATLAN_INSTANCE_URL}/api/service/segment/track`,
requestOptions
)
.then((resp) => {
console.log("Inside then", resp);
console.log("send segment event", action, body);
})
.catch((err) => {
console.log("Catch err", err);
console.log("couldn't send segment event", err);
});
} else {
console.log("Wuttt");
console.log("send segment event", action, body);
}

Expand Down Expand Up @@ -25576,7 +25573,6 @@ class GitHubIntegration extends IntegrationInterface {
}

if (total_assets !== 0) {
console.log("Checking");
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down Expand Up @@ -26362,7 +26358,7 @@ ${content}`;
headSHA,
"createIssueComment"
);
console.log(content);

return content;
}

Expand Down Expand Up @@ -34677,8 +34673,7 @@ ${content}`;
domain,
},
});
console.log("Action :", action);
console.log("raw", raw);

return sendSegmentEvent(action, raw);
} catch (error) {
logger_logger.withError(
Expand Down

0 comments on commit 8ff1a35

Please sign in to comment.