mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-03-02 22:57:00 -05:00
Do not allow duplicate tags per monitor? #415
Labels
No labels
A:accessibility
A:api
A:cert-expiry
A:core
A:dashboard
A:deployment
A:documentation
A:domain expiry
A:incidents
A:maintenance
A:metrics
A:monitor
A:notifications
A:reports
A:settings
A:status-page
A:ui/ux
A:user-management
Stale
ai-slop
blocked
blocked-upstream
bug
cannot-reproduce
dependencies
discussion
duplicate
feature-request
feature-request
good first issue
hacktoberfest
help
help wanted
house keeping
invalid
invalid-format
invalid-format
question
releaseblocker 🚨
security
spam
type:enhance-existing
type:new
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/uptime-kuma#415
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fdcastel on GitHub (Oct 14, 2021).
Is it a duplicate question?
No.
Is your feature request related to a problem? Please describe.
Maybe.
Describe the solution you'd like
I was a bit surprised when I saw this:
What is the value of
t1onmonitor1?I believe
monitor_tagtable should have a composite primary key (or an UNIQUE key/index) of(monitor_id, tag_id)blocking this occurrence in the db model.Describe alternatives you've considered
None.
Additional context
If this is indeed the intended design, please disregard. However, I found the semantics of having one tag with multiple values somewhat strange (or that one tag could be "present" multiple times).
I discovered this while working on a PR for https://github.com/louislam/uptime-kuma/issues/686.
@louislam commented on GitHub (Oct 14, 2021):
It is by design, more details: https://github.com/louislam/uptime-kuma/pull/278
Same Tags with different values = OK
Same Tags with same values = Not OK
@fdcastel commented on GitHub (Oct 14, 2021):
Ok. 😟 However, I didn't find any rationale for this behavior in #278.
There's a sample scenario? I really can't find any reason for this. It only keeps the code more complex, IMHO.
PR #705 would also be wrong in this case. Given that we cannot uniquely identify a tag just by name, an update of
t1=50will left twot1tags with value =50, bringing the monitor to "Not OK" scenario above.@chakflying commented on GitHub (Oct 14, 2021):
in previous suggestions to implement this feature, tags are mostly used for filtering and grouping. So something like having both
DNSandDNS: TXTmake sense. Your use case did not even cross my mind when I made this, but I totally see that this will be useful as well.If you think your use case won't be dealing with duplicate tags, I guess we can just update the first tag we find with that name?
@fdcastel commented on GitHub (Oct 14, 2021):
Understood. Thanks for the clarification @chakflying .
Yes. Updating the first tag is an option. I will update the PR for this scenario.
@CommanderStorm commented on GitHub (Jul 26, 2023):
@fdcastel is this issue still relevant?
If not, could you close it? (otherwise this will become an immortal zombie)
@fdcastel commented on GitHub (Jul 27, 2023):
Sure! 🧟 😄