Skip to content

Commit

Permalink
Merge pull request #98 from SumoLogic/hpal_evtgridtopic_fix
Browse files Browse the repository at this point in the history
adding condition system topic
  • Loading branch information
himanshu219 authored Jun 23, 2024
2 parents 198ec1d + 26c72a2 commit c94e95a
Show file tree
Hide file tree
Showing 41 changed files with 2,898 additions and 838 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/arm-template-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
- uses: bridgecrewio/checkov-action@master
with:
file: ${{ matrix.dir }}/${{ matrix.file }}
skip_check: CKV_AZURE_16,CKV_AZURE_17,CKV_AZURE_35
skip_check: CKV_AZURE_16,CKV_AZURE_17,CKV_AZURE_35,CKV_AZURE_78
quiet: false
framework: arm
output_format: cli
output_bc_ids: true
output_bc_ids: true
6 changes: 1 addition & 5 deletions AppendBlobReader/src/appendblobproducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,7 @@ function getDateDifferenceInMinutes(date_a, date_b) {
*/
function getTasksForUnlockedFiles(context) {

var maxIngestionDelayPerFile = 5;
let MS_PER_MINUTE = 60*1000;
var dateVal = new Date(new Date() - maxIngestionDelayPerFile*MS_PER_MINUTE);
// fetching unlocked files which were not enqueued in last 5 minutes
var existingFileQuery = `done eq ${false} and blobType eq '${'AppendBlob'}' and offset ge ${0} and ( not (lastEnqueLockTime gt '') or lastEnqueLockTime le '${dateVal.toISOString()}')`
var existingFileQuery = `done eq ${false} and blobType eq '${'AppendBlob'}' and offset ge ${0}`
return new Promise(function (resolve, reject) {
return queryFiles(existingFileQuery, context).then(function (allentities) {
var newFiletasks = [];
Expand Down
7 changes: 5 additions & 2 deletions AppendBlobReader/src/appendblobreaderdeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
"properties": {
"name": "[parameters('serverfarms_BlobReaderPlan_name')]",
"maximumElasticWorkerCount": 1,
"perSiteScaling": false,
"perSiteScaling": true,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0,
"reserved": false,
Expand All @@ -470,7 +470,7 @@
"properties": {
"name": "[parameters('serverfarms_ConsumerPlan_name')]",
"maximumElasticWorkerCount": 1,
"perSiteScaling": false,
"perSiteScaling": true,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0,
"reserved": false,
Expand Down Expand Up @@ -501,6 +501,7 @@
"http20Enabled": true,
"minTlsVersion": "1.2",
"scmMinTlsVersion": "1.2",
"netFrameworkVersion": "v6.0",
"alwaysOn": true,
"cors": {
"allowedOrigins": [ "https://portal.azure.com" ]
Expand Down Expand Up @@ -595,6 +596,7 @@
"http20Enabled": true,
"minTlsVersion": "1.2",
"scmMinTlsVersion": "1.2",
"netFrameworkVersion": "v6.0",
"alwaysOn": true,
"cors": {
"allowedOrigins": [ "https://portal.azure.com" ]
Expand Down Expand Up @@ -701,6 +703,7 @@
"http20Enabled": true,
"minTlsVersion": "1.2",
"scmMinTlsVersion": "1.2",
"netFrameworkVersion": "v6.0",
"alwaysOn": true,
"cors": {
"allowedOrigins": [ "https://portal.azure.com" ]
Expand Down
1 change: 1 addition & 0 deletions AppendBlobReader/src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function downloadErrorHandler(err, serviceBusTask, context) {
async function archiveIngestedFile(serviceBusTask, context) {
try {
// Delete entity from Azure Table Storage
// blobName should not be used directly since they might be truncated
await azureTableClient.deleteEntity(serviceBusTask.partitionKey, serviceBusTask.rowKey);
context.log(`Entity deleted, rowKey: ${serviceBusTask.rowKey}`);
} catch (error) {
Expand Down
8 changes: 5 additions & 3 deletions AppendBlobReader/src/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ function getRowKey(metadata) {
var arr = metadata.url.split('/').slice(3);
var keyArr = [storageName];
Array.prototype.push.apply(keyArr, arr);
return keyArr.join("-");
// key cannot be greater than 1KB or 1024 bytes;
var rowKey = keyArr.join("-");
return rowKey.substr(0,Math.min(1024, rowKey.length)).replace(/^-+|-+$/g, '');

}

function getBlobMetadata(message) {
Expand Down Expand Up @@ -301,8 +304,7 @@ module.exports = async function (context, eventHubMessages) {
context.done();
}

}
else {
} else {
context.log(`eventHubMessages might not pertain to appendblob or files with supported extensions, Exit now!`);
context.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,7 @@ function getDateDifferenceInMinutes(date_a, date_b) {
*/
function getTasksForUnlockedFiles(context) {

var maxIngestionDelayPerFile = 5;
let MS_PER_MINUTE = 60*1000;
var dateVal = new Date(new Date() - maxIngestionDelayPerFile*MS_PER_MINUTE);
// fetching unlocked files which were not enqueued in last 5 minutes
var existingFileQuery = `done eq ${false} and blobType eq '${'AppendBlob'}' and offset ge ${0} and ( not (lastEnqueLockTime gt '') or lastEnqueLockTime le '${dateVal.toISOString()}')`
var existingFileQuery = `done eq ${false} and blobType eq '${'AppendBlob'}' and offset ge ${0}`
return new Promise(function (resolve, reject) {
return queryFiles(existingFileQuery, context).then(function (allentities) {
var newFiletasks = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"default": "Warning",
"Host.Aggregator": "Trace",
"Host.Results": "Information",
"Function": "Trace"
"Function": "Information"
}
},
"functionTimeout": "00:10:00",
Expand Down
242 changes: 242 additions & 0 deletions AppendBlobReader/target/appendblob_producer_build/package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function downloadErrorHandler(err, serviceBusTask, context) {
async function archiveIngestedFile(serviceBusTask, context) {
try {
// Delete entity from Azure Table Storage
// blobName should not be used directly since they might be truncated
await azureTableClient.deleteEntity(serviceBusTask.partitionKey, serviceBusTask.rowKey);
context.log(`Entity deleted, rowKey: ${serviceBusTask.rowKey}`);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion AppendBlobReader/target/consumer_build/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"default": "Warning",
"Host.Aggregator": "Trace",
"Host.Results": "Information",
"Function": "Trace"
"Function": "Information"
}
}
}
Loading

0 comments on commit c94e95a

Please sign in to comment.