brynq-sdk-elastic 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/PKG-INFO +1 -1
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk/elastic/elastic.py +12 -9
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/PKG-INFO +1 -1
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/setup.py +1 -1
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk/elastic/__init__.py +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/not-zip-safe +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/requires.txt +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/top_level.txt +0 -0
- {brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/setup.cfg +0 -0
|
@@ -29,15 +29,15 @@ class Elastic:
|
|
|
29
29
|
self.client_user = os.getenv('BRYNQ_SUBDOMAIN', 'default').lower().replace(' ', '_') if customer_name is None else customer_name.lower().replace(' ', '_')
|
|
30
30
|
|
|
31
31
|
# Check for missing environment variables and show warnings
|
|
32
|
-
if
|
|
32
|
+
if os.getenv("ELASTIC_HOST") is None:
|
|
33
33
|
warnings.warn("Environment variable ELASTIC_HOST is not set. Using default: localhost")
|
|
34
|
-
if
|
|
34
|
+
if os.getenv("KIBANA_PORT") is None:
|
|
35
35
|
warnings.warn("Environment variable ELASTIC_PORT is not set. Using default: 9200")
|
|
36
|
-
if
|
|
36
|
+
if os.getenv("KIBANA_PORT") is None:
|
|
37
37
|
warnings.warn("Environment variable KIBANA_PORT is not set. Using default: 5601")
|
|
38
38
|
if elastic_token is None:
|
|
39
39
|
raise KeyError("Environment variable ELASTIC_API_KEY is not set and no api_key is provided. Please specify either one and try again")
|
|
40
|
-
if
|
|
40
|
+
if os.getenv("ELASTIC_SPACE") is None:
|
|
41
41
|
warnings.warn("Environment variable ELASTIC_SPACE is not set. Using 'default'")
|
|
42
42
|
if self.client_user == 'default':
|
|
43
43
|
warnings.warn("Environment variable BRYNQ_SUBDOMAIN is not set and customer_name is not specified. Using 'default'")
|
|
@@ -65,11 +65,14 @@ class Elastic:
|
|
|
65
65
|
:return: if the connection is established or not
|
|
66
66
|
"""
|
|
67
67
|
# Get the health of the database connection
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
try:
|
|
69
|
+
health = requests.get(url=f'{self.elasticsearch_host}/_cat/health?', headers=self.elastic_headers, verify=self.verify).status_code
|
|
70
|
+
if health != 200:
|
|
71
|
+
raise ConnectionError(f"Elasticsearch cluster health check failed with status code: {health}")
|
|
72
|
+
else:
|
|
73
|
+
return 'Healthy connection established with elasticsearch!'
|
|
74
|
+
except Exception as e:
|
|
75
|
+
raise ConnectionError(f'Elasticsearch was not reachable, error is: {e}')
|
|
73
76
|
|
|
74
77
|
def initialize_customer(self):
|
|
75
78
|
# Creates the index for the user if it does not exist yet
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-2.0.0 → brynq_sdk_elastic-2.0.1}/brynq_sdk_elastic.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|