Lukpier / flinkmonitoring

Flink exceptions alerting made simple (with go!).
Apache License 2.0
0 stars 0 forks source link

Customize message template #1

Open Lukpier opened 2 years ago

Lukpier commented 2 years ago

Message template should be specified via yaml configuration. If not available, the default one will apply.

RishiKumarRay commented 2 years ago

Can you Elaboarate this issue please?

Lukpier commented 2 years ago

Hi @RishiKumarRay,

func formatExceptions(job string, status JobStatus, exceptions *FlinkExceptions) string {
    s, err := json.MarshalIndent(exceptions, "", "  ")
    if err != nil {
        log.Println("cannot marshal: ", exceptions)
    }
    return fmt.Sprintf(`Dear maintainer,
            The Flink job %v has encountered exceptions. Its current status is %v.
            Below the exception list:
            %v
            `, job, status, s)
}

The function available in lookuper just formats job id, status and indented exception in the default template.

I would like to make the template configurable (via already existing yaml configuration). I was thinking to use gotemplate in a future.

Feel free to contribute if you want! 😄