Skip to content

Commit

Permalink
Merge pull request #8 from pagopa/hotfix-logs-and-redis
Browse files Browse the repository at this point in the history
fix: Improve logs & fix null message redis
  • Loading branch information
svariant authored Nov 21, 2024
2 parents 11650e5 + f8a8a9e commit 9d51bc2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ obj/
**/.terraform
**/node_modules
yarn.lock
**/*.copy
**/*.copy

# Misc
.azure/
24 changes: 14 additions & 10 deletions host.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@
},
"extensions": {
"eventHubs": {
"maxEventBatchSize": 128,
"batchCheckpointFrequency": 5,
"prefetchCount": 512,
"initialOffsetOptions": {
"type": "fromStart"
"maxEventBatchSize" : 128,
"batchCheckpointFrequency" : 5,
"prefetchCount" : 512,
"initialOffsetOptions" : {
"type" : "fromStart"
}
},
"http": {
"routePrefix": ""
}
},
"logging": {
"fileLoggingMode": "always",
"fileLoggingMode": "debugOnly",
"logLevel": {
"default": "Information",
"default": "None",
"Host.Results": "Error",
"Function": "Information",
"Host.Aggregator": "Trace"
"Function.BizEventEnrichmentProcessor": "Information",
"Function.EventHubBizEventProcessor": "Information",
"Host.Aggregator": "Error"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": false
"isEnabled": true,
"maxTelemetryItemsPerSecond": 5,
"includedTypes": "PageView;Trace;Dependency;Request",
"excludedTypes": "Exception;Event;CustomEvent"
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions test-utils/kafka-to-redis/kafka_event_hub_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async function eventHubToRedisHandler() {
try {
console.log("TOPICS ", evhTopics);
const kafka = new Kafka({
clientId: 'kafka-to-redis-app', brokers: [evhHost], //
authenticationTimeout: 10000, //
clientId: 'kafka-to-redis-app', brokers: [evhHost], //
authenticationTimeout: 10000, //
reauthenticationThreshold: 10000,
ssl: true,
sasl: {
Expand Down Expand Up @@ -44,10 +44,12 @@ async function eventHubToRedisHandler() {
let decoder = new TextDecoder("utf-8");
await consumer.run({
eachMessage: async ({ topic, partition, message, heartbeat, pause }) => {
writeOnRedis(client, decoder, message, topic);
if(message && message.value){
writeOnRedis(client, decoder, message, topic)
}
},
})

// when call client close?
// await client.quit();
} catch (e) {
Expand Down

0 comments on commit 9d51bc2

Please sign in to comment.