-
Notifications
You must be signed in to change notification settings - Fork 0
Initial implementation client/grpc_aio.py (#104) #105
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||
| from skywalking import agent, config | ||||||||||
|
|
||||||||||
| config.init(agent_collector_backend_services='localhost:11800') | ||||||||||
|
|
||||||||||
| agent.start() | ||||||||||
| from flask import Flask, jsonify | ||||||||||
| import logging | ||||||||||
|
|
||||||||||
| app = Flask(__name__) | ||||||||||
|
|
||||||||||
| # benchmarking: sw-python run python flask_single.py | ||||||||||
|
|
||||||||||
| @app.route('/cat', methods=['POST', 'GET']) | ||||||||||
| def cat(): | ||||||||||
| try: | ||||||||||
| logging.critical('fun cat got a request') | ||||||||||
| return jsonify({'Cat Fun Fact': 'Fact is cat, cat is fat'}) | ||||||||||
| except Exception as e: # noqa | ||||||||||
| return jsonify({'message': str(e)}) | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exception message is returned to the user: Data from [Exception] source(s) may reach [ReturnedToUser] sink(s) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
|
|
||||||||||
| if __name__ == '__main__': | ||||||||||
| app.run(host='0.0.0.0', port=9999, debug=False, use_reloader=False) | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| services: | ||
| oap: | ||
| container_name: oap | ||
| image: apache/skywalking-oap-server:9.2.0 | ||
| # Python agent supports gRPC/ HTTP/ Kafka reporting | ||
| expose: | ||
| - 11800 # gRPC | ||
| - 12800 # HTTP | ||
| networks: | ||
| - manual | ||
| # environment: | ||
| # # SW_KAFKA_FETCHER: default | ||
| # # SW_KAFKA_FETCHER_SERVERS: kafka:9092 | ||
| # # SW_KAFKA_FETCHER_PARTITIONS: 2 | ||
| # # SW_KAFKA_FETCHER_PARTITIONS_FACTOR: 1 | ||
| healthcheck: | ||
| test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11800" ] | ||
| interval: 5s | ||
| timeout: 100s | ||
| retries: 120 | ||
| ports: | ||
| - "12800:12800" | ||
| - "11800:11800" | ||
| # depends_on: | ||
| # - kafka | ||
|
|
||
|
|
||
| ui: | ||
| image: apache/skywalking-ui:9.2.0 | ||
| container_name: ui | ||
| depends_on: | ||
| oap: | ||
| condition: service_healthy | ||
| networks: | ||
| - manual | ||
| ports: | ||
| - "8080:8080" | ||
| environment: | ||
| SW_OAP_ADDRESS: "http://oap:12800" | ||
|
|
||
| # zookeeper: | ||
| # container_name: zk | ||
| # image: confluentinc/cp-zookeeper:latest | ||
| # ports: | ||
| # - "2181:2181" | ||
| # environment: | ||
| # ZOOKEEPER_CLIENT_PORT: 2181 | ||
| # ZOOKEEPER_TICK_TIME: 2000 | ||
| # networks: | ||
| # - manual | ||
|
|
||
| # kafka: | ||
| # container_name: kafka | ||
| # image: confluentinc/cp-kafka | ||
| # expose: | ||
| # - 9092 | ||
| # - 9094 | ||
| # ports: | ||
| # - 9092:9092 | ||
| # - 9094:9094 | ||
| # depends_on: | ||
| # - zookeeper | ||
| # environment: | ||
| # KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | ||
| # KAFKA_LISTENERS: INTERNAL://0.0.0.0:9092,OUTSIDE://0.0.0.0:9094 | ||
| # KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,OUTSIDE://localhost:9094 | ||
| # KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT | ||
| # KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL | ||
| # KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
| # networks: | ||
| # - manual | ||
|
|
||
|
|
||
| # kafka-ui: | ||
| # image: provectuslabs/kafka-ui | ||
| # container_name: kafka-ui | ||
| # ports: | ||
| # - "8088:8080" | ||
| # restart: always | ||
| # environment: | ||
| # - KAFKA_CLUSTERS_0_NAME=local | ||
| # - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 | ||
| # depends_on: | ||
| # - kafka | ||
| # networks: | ||
| # - manual | ||
|
|
||
| networks: | ||
| manual: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| uvicorn | ||
| fastapi | ||
| flask | ||
| uvloop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reportMissingImports: Import "flask" could not be resolved
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore@sonatype-lift ignoreall@sonatype-lift exclude <file|issue|path|tool>file|issue|path|toolfrom Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.