Skip to content

Commit

Permalink
chore(release): pull release/v1.69.0 into main (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai authored Jun 11, 2024
2 parents 6f1fff9 + 92953bf commit d963fe5
Show file tree
Hide file tree
Showing 29 changed files with 4,199 additions and 52,849 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ N/A

- [ ] Is the PR limited to one linear task?

- [ ] Are relevant unit and component test-cases added?
- [ ] Are relevant unit and component test-cases added in **new readability format**?

### Reviewer checklist

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.69.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.68.2...v1.69.0) (2024-06-10)


### Features

* add request_ip as fallback for mixpanel group call ([#3421](https://github.com/rudderlabs/rudder-transformer/issues/3421)) ([a73ab75](https://github.com/rudderlabs/rudder-transformer/commit/a73ab75032d753b35cb0e18234dcd7289dd1e644))
* add v3 api support to appsflyer ([#3412](https://github.com/rudderlabs/rudder-transformer/issues/3412)) ([e124470](https://github.com/rudderlabs/rudder-transformer/commit/e124470e82b6aa9934094146d4050af02bb62fff)), closes [#3395](https://github.com/rudderlabs/rudder-transformer/issues/3395) [#3402](https://github.com/rudderlabs/rudder-transformer/issues/3402)
* changes for supporting record event in FB audience ([#3351](https://github.com/rudderlabs/rudder-transformer/issues/3351)) ([ac4a32a](https://github.com/rudderlabs/rudder-transformer/commit/ac4a32ab5e0c7e02a149e81d455666ed24fa01a3))


### Bug Fixes

* allowing traffic type dynamically for split.io ([#3425](https://github.com/rudderlabs/rudder-transformer/issues/3425)) ([3bea186](https://github.com/rudderlabs/rudder-transformer/commit/3bea186e725ec473ad757760355d6cc9670c4f8c))
* bugsnag issue fix for zendesk ([#3439](https://github.com/rudderlabs/rudder-transformer/issues/3439)) ([775e8ee](https://github.com/rudderlabs/rudder-transformer/commit/775e8ee55a62ecddb58ff505302e4aabb8bffe24))

### [1.68.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.68.1...v1.68.2) (2024-06-06)


Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ We look forward to your feedback on improving this project.

[slack]: https://resources.rudderstack.com/join-rudderstack-slack
[issue]: https://github.com/rudderlabs/rudder-transformer/issues/new
[cla]: https://rudderlabs.wufoo.com/forms/rudderlabs-contributor-license-agreement
[cla]: https://forms.gle/845JRGVZaC6kPZy68
[config-generator]: https://github.com/rudderlabs/config-generator
49 changes: 26 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.68.2",
"version": "1.69.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down Expand Up @@ -65,7 +65,7 @@
"@ndhoule/extend": "^2.0.0",
"@pyroscope/nodejs": "^0.2.9",
"@rudderstack/integrations-lib": "^0.2.8",
"@rudderstack/workflow-engine": "^0.7.5",
"@rudderstack/workflow-engine": "^0.7.9",
"@shopify/jest-koa-mocks": "^5.1.1",
"ajv": "^8.12.0",
"ajv-draft-04": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ type Destination = {
WorkspaceID: string;
Transformations: UserTransformationInput[];
RevisionID?: string;
IsProcessorEnabled?: boolean;
IsConnectionEnabled?: boolean;
};

type UserTransformationLibrary = {
Expand Down
6 changes: 6 additions & 0 deletions src/util/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@ class Prometheus {
type: 'gauge',
labelNames: ['destination_id'],
},
{
name: 'braze_alias_failure_count',
help: 'braze_alias_failure_count',
type: 'counter',
labelNames: ['destination_id'],
},
{
name: 'mixpanel_batch_engage_pack_size',
help: 'mixpanel_batch_engage_pack_size',
Expand Down
2 changes: 2 additions & 0 deletions src/v0/destinations/af/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const Event = {
};

const ENDPOINT = 'https://api2.appsflyer.com/inappevent/';
const ENDPOINT_V2 = 'https://api3.appsflyer.com/inappevent/';

const mappingConfig = getMappingConfig(ConfigCategory, __dirname);

Expand All @@ -69,6 +70,7 @@ events.forEach((event) => {
module.exports = {
ConfigCategory,
ENDPOINT,
ENDPOINT_V2,
Event,
mappingConfig,
nameToEventMap,
Expand Down
44 changes: 36 additions & 8 deletions src/v0/destinations/af/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,32 @@ const {
simpleProcessRouterDest,
} = require('../../util');

const { Event, ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config');
const {
Event,
ENDPOINT,
ENDPOINT_V2,
ConfigCategory,
mappingConfig,
nameToEventMap,
} = require('./config');
const { JSON_MIME_TYPE } = require('../../util/constant');

function responseBuilderSimple(payload, message, destination) {
const { androidAppId, appleAppId } = destination.Config;
const { androidAppId, appleAppId, sharingFilter, devKey, s2sKey, authVersion } =
destination.Config;
let endpoint;
const os = get(message, 'context.os.name');
// if ((os && os.toLowerCase() === "android") || (os && isAppleFamily(os))){
// if()
// }

const finalEndPoint =
isDefinedAndNotNull(authVersion) && authVersion === 'v2' ? ENDPOINT_V2 : ENDPOINT;

if (os && os.toLowerCase() === 'android' && androidAppId) {
endpoint = `${ENDPOINT}${androidAppId}`;
endpoint = `${finalEndPoint}${androidAppId}`;
} else if (os && isAppleFamily(os) && appleAppId) {
endpoint = `${ENDPOINT}id${appleAppId}`;
endpoint = `${finalEndPoint}id${appleAppId}`;
} else {
throw new ConfigurationError(
'os name is required along with the respective appId eg. (os->android & Android App Id is required) or (os->ios & Apple App Id is required)',
Expand Down Expand Up @@ -87,16 +99,19 @@ function responseBuilderSimple(payload, message, destination) {
updatedPayload.bundleIdentifier = bundleIdentifier;
}

const { sharingFilter, devKey } = destination.Config;
// const { sharingFilter, devKey } = destination.Config;
if (isDefinedAndNotNullAndNotEmpty(sharingFilter)) {
updatedPayload.sharing_filter = sharingFilter;
}

const finalAuthentication =
isDefinedAndNotNull(authVersion) && authVersion === 'v2' ? s2sKey : devKey;

const response = defaultRequestConfig();
response.endpoint = endpoint;
response.headers = {
'Content-Type': JSON_MIME_TYPE,
authentication: devKey,
authentication: finalAuthentication,
};
response.method = defaultPostRequestConfig.requestMethod;
response.body.JSON = removeUndefinedAndNullValues(updatedPayload);
Expand Down Expand Up @@ -203,6 +218,19 @@ function processEventTypeTrack(message, config) {
}

function processSingleMessage(message, destination) {
const { devKey, s2sKey, authVersion, useRichEventName } = destination.Config;

if (!isDefinedAndNotNull(authVersion) && !isDefinedAndNotNull(devKey)) {
throw new ConfigurationError('No authentication key is present. Aborting.');
}

if (isDefinedAndNotNull(authVersion) && authVersion === 'v2' && !isDefinedAndNotNull(s2sKey)) {
throw new ConfigurationError('s2s key is mandatory for v2 authorization. Aborting.');
}

if (isDefinedAndNotNull(authVersion) && authVersion === 'v1' && !isDefinedAndNotNull(devKey)) {
throw new ConfigurationError('dev key is mandatory for v1 authorization. Aborting.');
}
const messageType = message.type.toLowerCase();
let payload;
switch (messageType) {
Expand All @@ -212,7 +240,7 @@ function processSingleMessage(message, destination) {
}
case EventType.SCREEN: {
let eventName;
if (destination.Config.useRichEventName === true) {
if (useRichEventName === true) {
eventName = `Viewed ${
message.name || message.event || get(message, 'properties.name') || ''
} Screen`;
Expand All @@ -224,7 +252,7 @@ function processSingleMessage(message, destination) {
}
case EventType.PAGE: {
let eventName;
if (destination.Config.useRichEventName === true) {
if (useRichEventName === true) {
eventName = `Viewed ${message.name || get(message, 'properties.name') || ''} Page`;
} else {
eventName = EventType.PAGE;
Expand Down
4 changes: 4 additions & 0 deletions src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
getPurchaseObjs,
setExternalId,
setAliasObjectWithAnonId,
collectStatsForAliasFailure,
} = require('./util');
const tags = require('../../util/tags');
const { EventType, MappedToDestinationKey } = require('../../../constants');
Expand Down Expand Up @@ -228,6 +229,7 @@ async function processIdentify(message, destination) {
endpointPath: '/users/identify',
},
);

if (!isHttpStatusSuccess(brazeIdentifyResp.status)) {
throw new NetworkError(
`Braze identify failed - ${JSON.stringify(brazeIdentifyResp.response)}`,
Expand All @@ -238,6 +240,8 @@ async function processIdentify(message, destination) {
brazeIdentifyResp.response,
);
}

collectStatsForAliasFailure(brazeIdentifyResp.response, destination.ID);
}

function processTrackWithUserAttributes(
Expand Down
43 changes: 43 additions & 0 deletions src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable */
const _ = require('lodash');
const get = require('get-value');
const { structuredLogger: logger } = require('@rudderstack/integrations-lib');
const stats = require('../../../util/stats');
const { handleHttpRequest } = require('../../../adapters/network');
const {
Expand Down Expand Up @@ -655,6 +656,47 @@ function getPurchaseObjs(message, config) {
return purchaseObjs;
}

const collectStatsForAliasFailure = (brazeResponse, destinationId) => {
/**
* Braze Response for Alias failure
* {
* "aliases_processed": 0,
* "message": "success",
* "errors": [
* {
* "type": "'external_id' is required",
* "input_array": "user_identifiers",
* "index": 0
* }
* ]
* }
*/

/**
* Braze Response for Alias success
* {
* "aliases_processed": 1,
* "message": "success"
* }
*/

// Should not happen but still checking for unhandled exceptions
if (!isDefinedAndNotNull(brazeResponse)) {
return;

Check warning on line 685 in src/v0/destinations/braze/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/braze/util.js#L685

Added line #L685 was not covered by tests
}
const { aliases_processed: aliasesProcessed, errors } = brazeResponse;
if (aliasesProcessed === 0) {
stats.increment('braze_alias_failure_count', { destination_id: destinationId });

Check warning on line 689 in src/v0/destinations/braze/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/braze/util.js#L689

Added line #L689 was not covered by tests

if (Array.isArray(errors)) {
logger.info('Braze Alias Failure Errors:', {

Check warning on line 692 in src/v0/destinations/braze/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/braze/util.js#L692

Added line #L692 was not covered by tests
destinationId,
errors,
});
}
}
};

module.exports = {
BrazeDedupUtility,
CustomAttributeOperationUtil,
Expand All @@ -667,4 +709,5 @@ module.exports = {
setExternalId,
setAliasObjectWithAnonId,
addMandatoryPurchaseProperties,
collectStatsForAliasFailure,
};
Loading

0 comments on commit d963fe5

Please sign in to comment.