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 support for cluster_id field for trigger creation #38

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# 4.2.0
kissken marked this conversation as resolved.
Show resolved Hide resolved

Add support for multiple clusters in trigger creation

Now you can use `cluster_id` field in api to set non-default cluster for remote triggers. List of available clusters can be seen in api at `https://your-moira-url/api/config`

# 4.1.0

Add support for prometheus trigger creation.

Now you canuse `trigger_source` field in api that overrides `is_remote` field
Now you can use `trigger_source` field in api that overrides `is_remote` field

# 4.0.2

Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.4
4.2.0
8 changes: 8 additions & 0 deletions moira_client/models/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
mute_new_metrics=False,
alone_metrics=None,
trigger_source=None,
cluster_id=None,
**kwargs):
"""

Expand All @@ -57,6 +58,7 @@ def __init__(
:param alone_metrics: dict with targets of alone metrics
:param kwargs: additional parameters
:param trigger_source: str specify trigger source, overrides is_remote
:param cluster_id: str specify cluster id
"""
self._client = client

Expand All @@ -75,6 +77,7 @@ def __init__(

self.is_remote = is_remote
self.trigger_source = trigger_source
self.cluster_id = cluster_id
self.mute_new_metrics = mute_new_metrics
self.alone_metrics = alone_metrics

Expand Down Expand Up @@ -153,6 +156,8 @@ def _send_request(self, trigger_id=None):

if self.trigger_source:
data['trigger_source'] = self.trigger_source
if self.cluster_id:
data['cluster_id'] = self.cluster_id

if trigger_id:
data['id'] = trigger_id
Expand Down Expand Up @@ -529,6 +534,7 @@ def create(
mute_new_metrics=False,
alone_metrics=None,
trigger_source=None,
cluster_id=None,
**kwargs
):
"""
Expand All @@ -549,6 +555,7 @@ def create(
:param alone_metrics: dict with targets of alone metrics
:param kwargs: additional trigger params
:param trigger_source: str specify trigger source, overrides is_remote
:param cluster_id: str specify cluster id
:return: Trigger
"""
return Trigger(
Expand All @@ -568,6 +575,7 @@ def create(
mute_new_metrics=mute_new_metrics,
alone_metrics=alone_metrics,
trigger_source=trigger_source,
cluster_id=cluster_id,
**kwargs
)

Expand Down
Loading