Ryu
  • 👩🏻‍💻 Ryu / software_engineer
  • ✨Resume
  • Python3
    • Python3 가상환경 설정하기
      • Python3 vs Python2
      • Pyenv
      • Venv
      • Pip
    • Flask
      • Flask 설치하기
      • API Server 만들기
    • REST API
    • Command Line 활용하기
    • Module 사용하기
      • Pickle - 자료형을 파일로 저장할 때
    • MongoDB connection
      • Pymongo
    • WSGI
      • 💡WSGI 가 필요한 이유
      • Web Server / WSGI / Middleware / Application 구조
      • WSGI Middleware 종류
      • Gunicorn
        • Gunicorn vs Uwsgi
    • Dockerize
      • 💡Dockerize 가 필요한 이유
      • 1. Create Dockerfile
        • Gunicorn 으로 nginx 와 app 연결하기
    • Kubernetes 로 배포하기
      • 💡Kubernetes 가 필요한 이유
      • Helm 사용하기
      • Helm 으로 k8s 에 앱 배포하기
  • Open Tracing (정리중)
    • Open Tracing 이란 무엇인가
    • Python OpenTracing Example
    • Jaeger, Jaeger UI
    • Python Jaeger Tutorial
    • Zipkin 알아보기
    • Jaeger-client 리스팅
  • Microservice Architecture
    • Netflix의 MSA 컨셉
      • ⚡️ MSA 를 도입할때 고려해야할 점들
  • Paper
    • Dynamo: Amazon’s Highly Available Key-value Store
      • 1. Introduction
      • 2. Background
      • 3. Related Work
        • Related Paper) Pastry, Chord
        • Byzantine Fault Tolerance
      • 4. System Architecture
        • 4.1 System Interface
        • 4.2 Partitioning
        • 4.3 Replication
        • Hash Function
  • Frontend
    • CommonJS 와 AMD
    • RequireJS
    • WebSocket
      • WebSocket vs Socket.io
      • polling vs long polling vs streaming
    • Vue.js
      • Vue.js 에서 WebSocket 사용하기
      • [프로젝트] Vue, Vuex, AntDesignVue 로 운영툴 만들기
    • React x Redux 로 프로젝트 만들기
      • 0. React, Redux 를 선택한 이유
      • 1. 프로젝트 생성하고 Webpack4 적용하기
      • 2. React 와 ReactDOM 적용하기
      • 3. Material UI 적용하기
  • Data Engineering
    • Spark
      • Spark 이란?
      • 각 데몬의 역할 Driver, Master, Worker
      • 장단점 / 함께사용하는 툴 / 사용 사례
  • Service Mesh (정리중)
    • RPC
    • gRPC - Python Server 만들기
      • step 2.
Powered by GitBook
On this page
  • ⌨️ Python 에서 opentracing 라이브러리 사용해보기
  • Install
  • Example
  • Basic features of OpenTracing API
  • Context manger 로 span 사용하기

Was this helpful?

  1. Open Tracing (정리중)

Python OpenTracing Example

Python 앱 opentracing 라이브러리 사용 예제

PreviousOpen Tracing 이란 무엇인가NextJaeger, Jaeger UI

Last updated 5 years ago

Was this helpful?

⌨️ Python 에서 opentracing 라이브러리 사용해보기

✔️ 코드를 참고하여 작성했습니다.

Install

$ pip install opentracing

Example

import opentracing
tracer = opentracing.tracer

def say_hello(hello_to):
    ## Span 시작
    span = tracer.start_span('say-hello')

    hello_str = 'Hello, %s!' % hello_to
    print(hello_str)

    ## Span 끝
    span.finish()

Basic features of OpenTracing API

  • start_span : 새로운 span 시작

    • span은 operation name 을 가집니다.

  • span.finish() : span 종료

  • 해당 span 의 start/end Timestamp 는 tracer implementation 에 의해 자동으로 측정됩니다.

Context manger 로 span 사용하기

def open_tracing_example_with_context_manager(hello_to):
    with tracer.start_span('say-hello') as span:
        hello_str = 'Hello, %s!' % hello_to
        print(hello_str)

이렇게까지하면 opentracing.tracer 의 포인트가 no-op tracer 에 있기 때문에, Tracing UI 에서는 확인할 수 없습니다.

이제 실제 Tracer 인스턴스를 생성해봅시다.

(다음 포스팅에 계속..)

https://github.com/yurishkuro/opentracing-tutorial/tree/master/python