muse-dev[bot] commented on a change in pull request #74: URL: https://github.com/apache/skywalking-python/pull/74#discussion_r495573524
########## File path: skywalking/client/kafka.py ########## @@ -0,0 +1,112 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import logging +import os + +from skywalking import config +from skywalking.client import ServiceManagementClient, TraceSegmentReportService +from skywalking.protocol.common.Common_pb2 import KeyStringValuePair +from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties + +from kafka import KafkaProducer + +logger = logging.getLogger(__name__) + +kafka_configs = {} + + +def __init_kafka_configs(): + kafka_configs["bootstrap_servers"] = config.kafka_bootstrap_servers.split(",") + # process all kafka configs in env + kafka_keys = [key for key in os.environ.keys() if key.startswith("SW_KAFKA_REPORTER_CONFIG_")] + for kafka_key in kafka_keys: + key = kafka_key[25:] + val = os.environ.get(kafka_key) + + if val is not None: + if val.isnumeric(): + val = int(val) + elif val in ["True", "False"]: + val = eval(val) Review comment: *blacklist:* Use of possibly insecure function - consider using safer ast.literal_eval. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
