Closed sotona- closed 4 years ago
Sorry but this sounds like a limitation with Telegram. Do you have a suggested fix?
Would something like this work: send inline-keyboard with /blackout + alert.id
and in https://github.com/alerta/alerta/blob/master/alerta/webhooks/telegram.py#L88 lookup env, resource and event from alert(id) ?
no because Alerta can't know which of the relevant attributes the operator wanted to define for the blackout period. ie. resource or event or env or all or others.
Hmm, I must be missing something here. This is how I understand this works:
blackout = Blackout(environment, resource=resource, event=event)
blackout.create()
So what I don't understand is that why can't step1 just send callback_data: '/blackout alert_id' and step4 do:
alert = Alert.find_by_id(alert_id, customers=customers)
blackout = Blackout(alert.environment, resource=alert.resource, event=alert.event)
since operator can't choose/change blackout values that come in the callback_data ?
I think https://github.com/alerta/alerta/blob/master/alerta/webhooks/telegram.py#L88 might be wrong:
command
(/blackout), alert_id
(Production|hostname.mycompany.com:9182|windows_low_memory)command
again, I think L88 should split alert_id
instead ? (splitting command
in L88 results in ValueError?) @jjh74 I've looked at this again and you are right about just sending the alert ID and extracting the environment, resource and event to generate the blackout period.
Issue Summary Telegram plugin can set an inline_keyboard for ack, close and blackout buttons. Callback_data for each button is limited to 64 bytes. Ack and Close buttons use fixed length("/[ack|close] event_uuid"), but Blackout button data can easily exceed the limit, b.c. it contains environment name, host name and alert rule name.
Environment docker image alerta-web:7.4.1
To Reproduce