Skip to content

Commit c33574e

Browse files
committed
Fixed coding style comments
1 parent dc403b2 commit c33574e

File tree

1 file changed

+8
-7
lines changed
  • manageability-and-operations/observability-and-manageability/oci-monitoring/custom-metrics/custom-metric-FN-services-limit-monitoring/files/Function

1 file changed

+8
-7
lines changed

manageability-and-operations/observability-and-manageability/oci-monitoring/custom-metrics/custom-metric-FN-services-limit-monitoring/files/Function/func.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,18 @@ def handler(ctx, data: io.BytesIO = None):
127127

128128
resp={}
129129
resp["Result"] = "OK"
130+
logger = logging.getLogger()
130131

131132
# We gather the input arguments from the function configuration:
132133
try:
133134
cfg = dict(ctx.Config())
134135
compartment_ocid = cfg["compartment_ocid"]
135136
region = cfg["region"]
136137
except (Exception, ValueError) as ex:
137-
logging.getLogger().error('ERROR: ' + str(ex))
138+
logger.error(str(ex))
138139

139140
# Start:
140-
logging.getLogger().info("Starting OCI Service Metrics limits gathering and customer metrics post...")
141+
logger.info("Starting OCI Service Metrics limits gathering and customer metrics post...")
141142

142143
# Setup the signer for the resource principals auth method
143144
signer = oci.auth.signers.get_resource_principals_signer()
@@ -154,19 +155,19 @@ def handler(ctx, data: io.BytesIO = None):
154155
break
155156
else:
156157
resp["Result"] = "NOT OK"
157-
resp["ERROR"] = "Wrong or non-subscribed OCI region"
158-
logging.getLogger().error('ERROR: Wrong or non-subscribed OCI region')
158+
resp["ERROR"] = "Wrong or non-subscribed OCI region."
159+
logger.error('Wrong or non-subscribed OCI region.')
159160
exit(1)
160161
except (Exception, ValueError) as ex:
161-
logging.getLogger().error('ERROR: ' + str(ex))
162+
logger.error(str(ex))
162163

163164

164165
# Check tenancy compartment OCID given
165166
try:
166167
list_availability_domains_response = identity_client.list_availability_domains(compartment_id = compartment_ocid)
167168
except Exception as ex:
168169
resp["Result"] = "NOT OK"
169-
resp["ERROR"] = "The given compartment is wrong or you aren't authorized to list the availability domains"
170+
resp["ERROR"] = "The given compartment is wrong or you aren't authorized to list the availability domains."
170171
exit(1)
171172

172173
service_endpoint = "https://telemetry-ingestion." + region + ".oraclecloud.com"
@@ -240,5 +241,5 @@ def handler(ctx, data: io.BytesIO = None):
240241

241242

242243
# Finish:
243-
logging.getLogger().info("Finish OCI Service Metrics limits gathering and customer metrics post.")
244+
logger.info("Finish OCI Service Metrics limits gathering and customer metrics post.")
244245
return resp

0 commit comments

Comments
 (0)