Skip to content

Commit

Permalink
enhancement(analytics): add properties to segment events
Browse files Browse the repository at this point in the history
  • Loading branch information
rittikdasgupta committed Oct 23, 2024
1 parent debfeee commit 47fa3fa
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import yaml from 'js-yaml';

var headSHA;
const integrationName = "GITHUB_CONTRACT_IMPACT_ANALYSIS";
const actionName = "contract_ci_action"
const actionName = "dbt_ci_action"
const utmSource = "dbt_github_action"

export default class ContractIntegration extends IntegrationInterface {
Expand Down Expand Up @@ -468,6 +468,8 @@ export default class ContractIntegration extends IntegrationInterface {
...properties,
github_action_id: `https://github.com/${context?.payload?.repository?.full_name}/actions/runs/${context?.runId}`,
domain,
base_asset_type: "atlanContract",
action_repo_name: "atlan-action"
},
});

Expand Down
40 changes: 22 additions & 18 deletions adapters/integrations/github-integration.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
// githubIntegration.js
import IntegrationInterface from "./contract/contract.js";
import github from "@actions/github";
import stringify from "json-stringify-safe";
import {
ATLAN_INSTANCE_URL,
IGNORE_MODEL_ALIAS_MATCHING,
IS_DEV,
} from "../utils/get-environment-variables.js";
import {
auth,
getCertificationImage,
getConnectorImage,
getEnvironments,
auth,
truncate,
} from "../utils/index.js";
import {
createResource,
getAsset,
getClassifications,
getDownstreamAssets,
sendSegmentEvent,
createResource,
getClassifications,
} from "../api/index.js";
import {
getSetResourceOnAssetComment,
getErrorResponseStatus401,
getErrorResponseStatusUndefined,
getAssetInfo,
getDownstreamTable,
getViewAssetButton,
getMDCommentForModel,
getErrorResponseStatus401,
getErrorResponseStatusUndefined,
getMDCommentForMaterialisedView,
getMDCommentForModel,
getSetResourceOnAssetComment,
getTableMD,
getViewAssetButton,
} from "../templates/github-integration.js";
import { getNewModelAddedComment, getBaseComment } from "../templates/atlan.js";
import {
IS_DEV,
ATLAN_INSTANCE_URL,
IGNORE_MODEL_ALIAS_MATCHING,
} from "../utils/get-environment-variables.js";
import { getBaseComment, getNewModelAddedComment } from "../templates/atlan.js";

// githubIntegration.js
import IntegrationInterface from "./contract/contract.js";
import github from "@actions/github";
import logger from "../logger/logger.js";
import stringify from "json-stringify-safe";

var headSHA;
const integrationName = "github";
export default class GitHubIntegration extends IntegrationInterface {
Expand Down Expand Up @@ -575,6 +577,8 @@ export default class GitHubIntegration extends IntegrationInterface {
...properties,
github_action_id: `https://github.com/${context?.payload?.repository?.full_name}/actions/runs/${context?.runId}`,
domain,
base_asset_type: "dbtModel",
action_repo_name: "atlan-action"
},
});

Expand Down
63 changes: 33 additions & 30 deletions adapters/integrations/gitlab-integration.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
// gitlabIntegration.js
import IntegrationInterface from "./contract/contract.js";
import { Gitlab } from "@gitbeaker/rest";
import {
createResource,
getAsset,
getDownstreamAssets,
sendSegmentEvent,
getClassifications,
} from "../api/index.js";
ATLAN_INSTANCE_URL,
CI_COMMIT_MESSAGE,
CI_COMMIT_SHA,
CI_JOB_URL,
CI_PROJECT_ID,
CI_PROJECT_NAME,
CI_PROJECT_NAMESPACE,
CI_PROJECT_PATH,
IGNORE_MODEL_ALIAS_MATCHING,
IS_DEV,
getCIMergeRequestIID,
} from "../utils/get-environment-variables.js";
import {
auth,
getConnectorImage,
getCertificationImage,
getConnectorImage,
getGitLabEnvironments,
truncate,
} from "../utils/index.js";
import stringify from "json-stringify-safe";
import {
getSetResourceOnAssetComment,
getErrorResponseStatus401,
getErrorResponseStatusUndefined,
createResource,
getAsset,
getClassifications,
getDownstreamAssets,
sendSegmentEvent,
} from "../api/index.js";
import {
getAssetInfo,
getDownstreamTable,
getViewAssetButton,
getMDCommentForModel,
getErrorResponseStatus401,
getErrorResponseStatusUndefined,
getMDCommentForMaterialisedView,
getMDCommentForModel,
getSetResourceOnAssetComment,
getTableMD,
getViewAssetButton,
} from "../templates/gitlab-integration.js";
import { getNewModelAddedComment, getBaseComment } from "../templates/atlan.js";
import {
IS_DEV,
ATLAN_INSTANCE_URL,
CI_PROJECT_PATH,
CI_PROJECT_ID,
CI_JOB_URL,
IGNORE_MODEL_ALIAS_MATCHING,
CI_COMMIT_MESSAGE,
CI_PROJECT_NAME,
CI_COMMIT_SHA,
getCIMergeRequestIID,
CI_PROJECT_NAMESPACE,
} from "../utils/get-environment-variables.js";
import { getBaseComment, getNewModelAddedComment } from "../templates/atlan.js";

import { Gitlab } from "@gitbeaker/rest";
// gitlabIntegration.js
import IntegrationInterface from "./contract/contract.js";
import logger from "../logger/logger.js";
import stringify from "json-stringify-safe";
const integrationName = "gitlab";
var CI_MERGE_REQUEST_IID;

Expand Down Expand Up @@ -647,6 +648,8 @@ ${content}`;
...properties,
gitlab_job_id: CI_JOB_URL,
domain,
base_asset_type: "dbtModel",
action_repo_name: "atlan-action"
},
});

Expand Down
Loading

0 comments on commit 47fa3fa

Please sign in to comment.