Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entity_display_name for VictorOps, use better state_message #769

Merged
merged 4 commits into from
Jul 3, 2017
Merged

Add entity_display_name for VictorOps, use better state_message #769

merged 4 commits into from
Jul 3, 2017

Conversation

siavashs
Copy link
Contributor

@siavashs siavashs commented May 4, 2017

This PR fixes #580 and uses a better state_message since this field has a high character limit and is intended for a long, verbose, explanation of the problem.

More details about REST endpoint can be found here.

Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a pointer to the docs for this field?

@@ -46,9 +46,19 @@ Alerts Resolved:
{{ define "opsgenie.default.source" }}{{ template "__alertmanagerURL" . }}{{ end }}


{{ define "victorops.default.state_message" }}{{ template "__subject" . }} | {{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.monitoring_tool" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "victorops.default.state_message" }}{{ template "__alertmanager" . }}: {{ template "__alertmanagerURL" . }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't create additional default formats, use what we already have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using __subject as entity_display_name now, and using a more verbose state_message(similar to opsgenie.default.description) instead of __subject.
In other words having __subject in 2 different fields is not very useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to maintain a format per notifier is not desirable, this should be a copy (preferably a template) of what we already have for this type of long-form field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, I will use the same template used for opsgenie.default.description.

@siavashs
Copy link
Contributor Author

siavashs commented May 4, 2017

Please see entity_display_name and state_message under Required / Recommended Fields

@siavashs
Copy link
Contributor Author

siavashs commented May 9, 2017

Not sure if this is the right place to mention this: having the generated binary files in repository causes problems with rebasing forks and PRs.

@mxinden
Copy link
Member

mxinden commented May 9, 2017

@siavashs In regards to the generated binary files: We plan to address this with the new UI in the future (See ui-rewrite branch)

@devinodaniel
Copy link

@siavashs Thanks for your work on this thus far. Is there anything I could do to help with getting this merged? Having entity_display_name would be sweet as we use VO but having the subject of an alert be a random hash is killing our mo-jo.

@siavashs
Copy link
Contributor Author

siavashs commented Jun 9, 2017

@devinodaniel I'm still waiting for maintainers to merge this. Regarding the entity_id the documentation says:

ID of the Incident [String]
This field is the identity of the incident and must remain the same throughout the life-cycle of an incident. Make sure you use the same entity_id when triggering, acking, or resolving an incident. Example: "/", i.e... "diskspace/db01.mycompany.com"
If no entity_id is included, a random string will be used.

alertmanager uses sha256 hash of the alert group key for this, so it can later resolve the incident using the same entity_id.
It is possible to generate a string like the above example but I'd like the maintainers to comment on this.

@ramiamar
Copy link

+1
We @ alooma.com would also love to be able to set the entity_display_name

@stuartnelson3
Copy link
Contributor

@siavashs we've talked about how to generate identifiers that would lend themselves to being used as entity_id, but I don't think we've made any active progress on it.

Could you fix the conflict with config/notifiers.go? I'll merge after that, sorry for the long delay.

@siavashs
Copy link
Contributor Author

@stuartnelson3 done, not sure why travis-ci is failing though.

@mxinden
Copy link
Member

mxinden commented Jun 26, 2017

@siavashs Your /template/internal/deftmpl/bindata.go is out of sync, just run make assets and add bindata.go to your commit.

@siavashs
Copy link
Contributor Author

@mxinden When I try to build the assets I get this error:

> make assets
>> writing assets
bindata: Failed to stat input path 'ui/app/script.js': lstat ui/app/script.js: no such file or directory
make: *** [assets] Error 1

@mxinden
Copy link
Member

mxinden commented Jun 26, 2017

@siavashs Ah, yes. This will be fixed with #792 but I haven't updated the PR yet. Can you comment out line 63 - 68 and then try again?

@mxinden
Copy link
Member

mxinden commented Jun 26, 2017

Cool, I guess that worked. I would still like @stuartnelson3 to look over this, as he was more involved so far.

Copy link
Contributor

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@stuartnelson3
Copy link
Contributor

stuartnelson3 commented Jun 27, 2017 via email

@fabxc
Copy link
Contributor

fabxc commented Jun 28, 2017

@siavashs, sorry about not looking at this earlier. This generally looks good to me. The documentation on state_message is pretty vague by saying "This field has a high character limit...".

We have had problems in the past by our generated messages causing receiver APIs to reject our notifications, which is pretty bad obviously.
Given that these changes put a full list of all alerts into this field and there can be hundreds of alerts in a single notification, we should add some safety checks here.

Can we find out what the actual maximum length is and then truncate the generated text for this field to that length? Limiting to something like 4KB is probably sensible.

@siavashs
Copy link
Contributor Author

@fabxc good point, I sent a request to VictorOps support regarding the maximum length of state_message.

@siavashs
Copy link
Contributor Author

Response from VictorOps support:

The maximum length for the state_message field is 20KB.

I will add a check for state_message length and truncate it if exceeded 20KB.

@fabxc
Copy link
Contributor

fabxc commented Jul 3, 2017

Thanks

@fabxc fabxc merged commit d5f0d17 into prometheus:master Jul 3, 2017
@devinodaniel
Copy link

devinodaniel commented Jul 5, 2017

Thanks all for getting this merged in, any chance an update to the docs can be made to reflect this capability?

@mxinden mxinden mentioned this pull request Jul 15, 2017
hh pushed a commit to ii/alertmanager that referenced this pull request Feb 28, 2018
This is clearer behavior and users will notice and fix their textfiles faster
than if we just output a warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add title support VictorOps receiver
8 participants