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 Slack field configuration documentation #1002

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions content/docs/alerting/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,23 @@ channel: <tmpl_string>
[ text: <tmpl_string> | default = '{{ template "slack.default.text" . }}' ]
[ fallback: <tmpl_string> | default = '{{ template "slack.default.fallback" . }}' ]

# An optional flag indicating whether the value(s) of all fields defined
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep the style consistent with what's above.

# are short enough to be displayed side-by-side with any other value(s).
[ short_fields: <boolean> ]

# An optional list of key/value pairs to provide further details about the incident.
# The key/value pairs contained within it will be displayed in a table inside the
# message attachment.
[ fields:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the structure that is defined in the code.

Copy link
Author

@taharah taharah Apr 16, 2018

Choose a reason for hiding this comment

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

Not quite sure what you mean here. The way the code reads is a little misleading since it looks like it's looping over a map at first glance [1], but the structure is definitely a list of key/value pairs albeit very specific, i.e., needs to include both the title and value for each field defined. Thus, do you mean that the description in the preceding comment of the structure is inaccurate and needs to be more specific?

I've tested and used the following configuration for defining two different fields:

fields:
- title: 'severity'
  value: '{{ .GroupLabels.severity }}'
- title: 'status'
  value: '{{ .Status }}'

Copy link
Contributor

Choose a reason for hiding this comment

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

The code allows for any field to be supplied, not just title and value.

Copy link
Author

Choose a reason for hiding this comment

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

Any number of fields can be defined, but it needs both the title [1] and value [2] defined for each field and then inherits the short parameter as a global setting for all fields [3, 4]. This is the required structure for fields as per the Slack documentation [5].

Copy link
Contributor

Choose a reason for hiding this comment

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

That is still not what is implemented in the alertmanager. I think you need to fix the code.

- # Title is shown as a bold heading above the value text.
# It cannot contain markup and will be escaped for you.
title: <tmpl_string>
# The text value of the field. It may contain standard message
# markup and must be escaped as normal. May be multi-line.
value: <tmpl_string>
]


# The HTTP client's configuration.
[ http_config: <http_config> | default = global.http_config ]
```
Expand Down