Open MastroCiccio opened 5 months ago
It looks like a bug to me. I'll fix it in the next release.
Thank you!
Any news about this issue?
I've looked at the code of the CloudwatchPublisher type in the namespace com.brunobonacci.mulog.publishers.cloudwatch I think the bug could be solved by updating the method publish as follows:
(publish [_ buffer]
;; items are pairs [offset <item>]
(let [items (take (:max-items config) (rb/items buffer))
last-offset (-> items last first)]
(if-not (seq items)
buffer
;; else send to cloudwatch
(let [transformed-items (transform (map second items))]
(when (seq transformed-items)
(put-log-events cw-client stream-name config transformed-items next-token))
(rb/dequeue buffer last-offset)))))
I can submit a PR if you prefer.
Sorry, I've been swamped with work.
I hope to release it in the next few weeks. I'd like to check this issue across all publishers and not jut the CloudWatch one.
Hi, I noticed the CloudWatch publisher to generate an error event whenever the transform function returns the empty sequence since the AWS API PutLogEvents does not accept the empty array as the input.
Here the details of the error from the mulog event:
Here a possible implementation to replicate the scenario:
Is this a desired behavior? I'm implementing a solution with different publishers: since the CloudWatch publisher matches only a specific set of events, it wouldn't be unusual for the transform function to return the empty seq, thus generating the error event catched by the other publishers. For now I'm filtering out this specific error from the other publishers, but it's kind of annoying...
Thanks for the help