Skip to content

Commit 5e75eb4

Browse files
authored
Add the ability of the consumer to attach reference url (#36)
1 parent 6a90d27 commit 5e75eb4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

eppo_metrics_sync/eppo_metrics_sync.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ def _determine_sync_tag(self):
131131

132132
return os.getenv('EPPO_SYNC_TAG')
133133

134+
def _attach_reference_url(self, payload):
135+
"""
136+
Optionally attach reference url to the payload if one exists
137+
"""
138+
139+
reference_url = os.getenv('EPPO_REFERENCE_URL')
140+
if not reference_url:
141+
return payload
142+
143+
payload["reference_url"] = reference_url
144+
return payload
145+
134146
def sync(self):
135147
self.read_yaml_files()
136148
if self.sync_prefix is not None:
@@ -151,6 +163,7 @@ def sync(self):
151163
"fact_sources": self.fact_sources,
152164
"metrics": self.metrics
153165
}
166+
payload = self._attach_reference_url(payload)
154167

155168
response = requests.post(f'{API_ENDPOINT}{"?allow_upgrades=true" if self.allow_upgrades else ""}', json=payload, headers=headers)
156169

0 commit comments

Comments
 (0)