grafana / oncall

Developer-friendly incident response with brilliant Slack integration
GNU Affero General Public License v3.0
3.51k stars 291 forks source link

Jinja template result max length too short #2911

Open 12doge-LEO opened 1 year ago

12doge-LEO commented 1 year ago

What would you like to see!

Hello, when I tried to send an image by base64, I found the length limits of Jinja template is not long enough. Currently the length is set to 50,000 like:

JINJA_TEMPLATE_MAX_LENGTH = 50000
JINJA_RESULT_TITLE_MAX_LENGTH = 500
JINJA_RESULT_MAX_LENGTH = 50000

Can you please change this config to an editable param?

By the way, is there any better solution to send an image via grafana on-call? In my case, image-url cannot be used in this case because our user prefer to direct send an image by base64 or file

Looking forward to your reply, thanks!

Product Area

Alert Flow & Configuration

Anything else to add?

No response

github-actions[bot] commented 1 year ago

The current version of Grafana OnCall, at the time this issue was opened, is v1.3.29. If your issue pertains to an older version of Grafana OnCall, please be sure to list it in the PR description. Thank you :smile:!

Hridoy-31 commented 1 year ago

Hi there!

I'd like to express my interest in working on this issue.

If you have any specific guidelines, suggestions, or additional context to provide, please feel free to share them. I'm eager to collaborate and make a positive contribution to this project.

Looking forward to your response!

buddhdev-harsh commented 7 months ago

Hello @Matvey-Kuk ,

I am interested in working on this issue.

I think we can solve this issue in one of the 3 ways,

  1. we can remove the length for Jinja template, not sure how that will be consumed once removed (the user will be able to upload big files)
  2. we can keep this range and if the template > 50000 then prompt the user for editable params and allow user to upload the file again it can cause the same issue as above but then we can put another limit, which will make 50000 > template_size < 70000. To prevent the above case.
  3. if we consider the second case then it would be efficient to increase the limit directly to 70000, just to prevent double checking if it >50000.

I would appreciate your feedback on these solutions and how you would like them implemented for this feature.

Riksus commented 3 months ago

@Matvey-Kuk @buddhdev-harsh please add the ability to change from via env

Matvey-Kuk commented 3 months ago

@Riksus I stepped back from working on OnCall, forwarding this to @joeyorlando <3

Riksus commented 2 months ago

https://github.com/grafana/oncall/blob/7112be811681264db541b89fa94523d940d95525/engine/apps/alerts/models/channel_filter.py#L86 for this too

joeyorlando commented 2 months ago

@Riksus we would review a PR if you're wiling to put one together 🙂