Then something strange is going on. Are you 100% sure that you pasted *exactly* the configuration file you're using, with *exactly* the correct contents and indentation?
You can add labels in your service discovery, e.g. if you are using file_sd_configs then inside the targets file you can put
- labels:
owner: teamA
targets:
- foo
- bar
- baz
- labels:
owner: teamB
targets:
- qux
In this case, all timeseries which are scraped from the hosts will have those labels added as attributes of every timeseries.
Or you can add labels in your alerting rules:
groups:
- name: UpDown
rules:
- alert: UpDownTeamA
expr: up{instance=~"foo|bar|baz"} == 0
for: 3m
keep_firing_for: 3m
labels:
owner: teamA
- alert: UpDownTeamB
expr: up{instance=~"qux"} == 0
for: 3m
keep_firing_for: 3m
labels:
owner: teamB
It's up to you on whether you want to label the timeseries themselves (which is simpler but less flexible), or do the labelling in the alerting rules (which means you may need to look at other labels to decide how to route things, but allows you to change your alert routing without changing the underlying timeseries)
In alertmanager you'd then match labels to decide where to deliver.
route:
# Default receiver (for all alerts that don't match any specific route)
receiver: "everyone"
routes:
- matchers:
- owner=teamA
receiver: "gmail"
- matchers:
- owner=teamB
receiver: "dev-receiver"
This simple example says alerts with owner=teamA go to "gmail", alerts with owner=teamB go to "dev-receiver", and everything else goes to "everyone". (The first match stops any subsequent processing, unless that rule has "continue: true")
There is a tool you can test your alertmanager config with here:
Try pasting in the above block, then click "Draw routing tree". Then next to Match Label Set, enter
{instance="foo",owner="teamA"}
and click Match Label Set.
HTH.