Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Apr 1, 2023
2 parents d265edf + 3089519 commit 3a76adc
Show file tree
Hide file tree
Showing 54 changed files with 1,849 additions and 270 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -52,7 +52,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -124,7 +124,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-hotfix-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest

# Only allow these users to create new hotfix branch from 'main'
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs')
if: github.ref == 'refs/heads/main' && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs') && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs')
steps:
- name: Create Branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'hotfix/${{ github.event.inputs.hotfix_name }}'
branch: 'hotfix/${{ inputs.hotfix_name }}'
8 changes: 7 additions & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/')) && (github.actor == 'ItsSudip' || github.actor == 'krishna2020' || github.actor == 'saikumarrs' ) && (github.triggering_actor == 'ItsSudip' || github.triggering_actor == 'krishna2020' || github.triggering_actor == 'saikumarrs')
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0

Expand All @@ -21,6 +21,12 @@ jobs:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
env:
HUSKY: 0
run: |
npm ci
# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize Mandatory Git Config
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Handle Stale PRs, Issues and Branhes
name: Handle Stale PRs, Issues and Branches

on:
schedule:
- cron: '42 1 * * *'
# Run everyday at 1 AM
- cron: '0 1 * * *'

jobs:
prs:
Expand All @@ -13,9 +14,9 @@ jobs:
pull-requests: write

steps:
- uses: actions/stale@v7.0.0
- uses: actions/stale@v8.0.0
with:
repo-token: ${{ github.token }}
repo-token: ${{ secrets.PAT }}
operations-per-run: 200
stale-pr-message: 'This PR is considered to be stale. It has been open for 20 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.'
stale-issue-message: 'This issue is considered to be stale. It has been open for 30 days with no further activity thus it is going to be closed in 7 days. To avoid such a case please consider removing the stale label manually or add a comment to the issue.'
Expand All @@ -31,12 +32,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0

- name: Delete Old Branches
uses: beatlabs/[email protected]
with:
repo_token: ${{ github.token }}
repo_token: ${{ secrets.PAT }}
date: '3 months ago'
dry_run: false
delete_tags: false
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:

jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml

Expand All @@ -35,7 +36,7 @@ jobs:
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down Expand Up @@ -96,7 +97,7 @@ jobs:
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/prepare-for-prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:

jobs:
report-coverage:
name: Report Code Coverage
if: github.event_name == 'push'
uses: ./.github/workflows/report-code-coverage.yml

Expand All @@ -29,7 +30,7 @@ jobs:
tag_name: ${{ steps.gen_tag_name.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -50,7 +51,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down Expand Up @@ -109,7 +110,7 @@ jobs:
tag_name: ${{ steps.gen_tag_name.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -130,7 +131,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down Expand Up @@ -189,7 +190,7 @@ jobs:
UT_TAG_NAME: ${{ needs.build-user-transformer-image.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/prepare-for-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/'))
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -46,7 +46,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/'))
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand All @@ -125,7 +125,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

- name: Cache Docker Layers
uses: actions/cache@v3.2.1
uses: actions/cache@v3.3.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
UT_TAG_NAME: ${{ needs.build-user-transformer-image.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down
44 changes: 41 additions & 3 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
echo "release_version=$version" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0

Expand All @@ -35,6 +35,12 @@ jobs:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
env:
HUSKY: 0
run: |
npm ci
# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize Mandatory Git Config
Expand All @@ -46,8 +52,8 @@ jobs:
id: create_release
env:
HUSKY: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT }}
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.PAT }}
run: |
git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}"
git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }}
Expand Down Expand Up @@ -79,3 +85,35 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Notify Slack Channel
id: slack
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'Rudder Transformer'
RELEASES_URL: 'https://github.com/rudderlabs/rudder-transformer/releases/tag/'
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":tada: ${{ env.PROJECT_NAME }} - New GitHub Release :tada:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U02AE5GMMHV> <@U01LVJ30QEB>"
}
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/report-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 1

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
[![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
[![codecov](https://codecov.io/gh/rudderlabs/rudder-transformer/branch/develop/graph/badge.svg?token=G24OON85SB)](https://codecov.io/gh/rudderlabs/rudder-transformer)


# RudderStack Transformer

RudderStack Transformer is a service which transforms the RudderStack events to destination-specific singular events. This feature is released under
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "",
"main": "GATransform.js",
"scripts": {
"setup": "npm i",
"setup": "npm ci",
"format": "prettier --write .",
"lint": "eslint . || exit 0",
"lint:fix": "eslint . --fix",
Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PORT=9090 # application's port
METRICS_PORT=9091 # metrics's port
ENABLE_FUNCTIONS=true # user transformation functions
CLUSTER_ENABLED=true # cluster mode
NUM_PROCS=1 # Number of workers in the cluster mode
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/destinationProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const jsonDiff = require('json-diff');
const networkHandlerFactory = require('../adapters/networkHandlerFactory');
const { getPayloadData } = require('../adapters/network');
const { generateErrorObject } = require('../v0/util');
const stats = require('../util/stats');
const logger = require('../logger');
const tags = require('../v0/util/tags');
const stats = require('../util/stats');

const DestProxyController = {
/**
Expand Down
18 changes: 15 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ const logger = require('./logger');

const { router } = require('./versionedRouter');
const { testRouter } = require('./testRouter');
const { metricsRouter } = require('./metricsRouter');
const cluster = require('./util/cluster');
const { addPrometheusMiddleware } = require('./middleware');
const { addStatMiddleware } = require('./middleware');
const { logProcessInfo } = require('./util/utils');

const clusterEnabled = process.env.CLUSTER_ENABLED !== 'false';

const port = parseInt(process.env.PORT || '9090', 10);
const metricsPort = parseInt(process.env.METRICS_PORT || '9091', 10);

const app = new Koa();
addPrometheusMiddleware(app);
addStatMiddleware(app);

const metricsApp = new Koa();
addStatMiddleware(metricsApp);
metricsApp.use(metricsRouter.routes()).use(metricsRouter.allowedMethods());

app.use(
bodyParser({
Expand All @@ -31,8 +38,13 @@ function finalFunction() {
}

if (clusterEnabled) {
cluster.start(port, app);
cluster.start(port, app, metricsApp);
} else {
// HTTP server for exposing metrics
if (process.env.STATS_CLIENT === 'prometheus') {
metricsApp.listen(metricsPort);
}

const server = app.listen(port);

process.on('SIGTERM', () => {
Expand Down
Loading

0 comments on commit 3a76adc

Please sign in to comment.