Skip to main content

yyxx game custom module

Project description

[TOC]

yyxx-game-pkg

yyxx-game-pkg 是一个专门为 yyxx 公司开发的 Python 内部接口集合。

模块

xtrace

xtrace 模块封装了链路追踪的帮助类,可以帮助开发人员快速地实现链路追踪功能。该模块提供了以下功能:

  • 封装了调用链路追踪的相关逻辑,可以自动记录服务间的调用关系。
  • 提供了统一的接口,方便开发人员在不同的应用场景中调用。

调用例子:

  • 初始化
from yyxx_pkg.xtrace.helper import register_to_jaeger, get_tracer
from opentelemetry.instrumentation.requests import RequestsInstrumentor


# init instrumentation.requests 
RequestsInstrumentor().instrument()

# init jaeger exporter
register_to_jaeger("your server name", "jaeger-host")

if __name__ == '__main__':
    pass
  • 业务链路埋点
from yyxx_pkg.xtrace.helper import trace_span

@trace_span()
def func_business():
    # your business function
    pass

@trace_span(ret_trace_id=True)
def func_business_with_trace_id():
    # your business function
    ret_val = "success"
    
    # real return: ret_val, trace_id
    return ret_val

@trace_span(set_attributes=True)
def func_business_on_set_attributes(**kwargs):
    # your business function
    ret_val = "success"
    
    # record **kwargs as jaeger tags
    return ret_val

stat

stat模块包含yyxxgame内部统计业务的底层框架,目前包含dispatchsubmitxcelery几个模块

dispatch

业务分发基础模块

submit

任务提交基础模块

xcelery

celery封装层

生产环境配置

python3环境中执行:

pip install yyxx-game-pkg

开发环境配置

clone 代码

git clone https://github.com/yyxxgame/yyxxgame-pkg

安装poetry

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

配置虚拟环境并显式激活

- poetry env use python3
- poetry env list
- poetry shell

安装更新开发包

- poetry install
- poetry update

版本发布

develop

提交注释中添加[BUILD]关键字并推送会触发github actions的dev版本构建并发布到yyxx-game-pkg-dev

release

新建tag并推送会触发github actions的正式版本构建并发布到yyxx-game-pkg

参考文档

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yyxx_game_pkg-2023.3.21.1.tar.gz (4.4 MB view details)

Uploaded Source

Built Distribution

yyxx_game_pkg-2023.3.21.1-py3-none-any.whl (4.4 MB view details)

Uploaded Python 3

File details

Details for the file yyxx_game_pkg-2023.3.21.1.tar.gz.

File metadata

  • Download URL: yyxx_game_pkg-2023.3.21.1.tar.gz
  • Upload date:
  • Size: 4.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.2 Linux/5.15.0-1034-azure

File hashes

Hashes for yyxx_game_pkg-2023.3.21.1.tar.gz
Algorithm Hash digest
SHA256 664ba50393890e6c0225b96bc0958ec8350746b4196cdf9faa4260d6aa16404c
MD5 c5994e854760b0769dbd4c47a86cbdc2
BLAKE2b-256 79259d40b52eedc6bfd72c2ba25b02142d9423dad6ae58d402b2d3bd300c4127

See more details on using hashes here.

File details

Details for the file yyxx_game_pkg-2023.3.21.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yyxx_game_pkg-2023.3.21.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b5dcee633eb52c0e4ffbec9bf665d6e93aa932b2eba128ca20fd5f788495b4
MD5 0a42ab94253ddf9f325167365ce0dd7a
BLAKE2b-256 2fbf3fc6b1840f13d99bb9069d9c51de0c7a5f8d7c916d2a129fbd4555ae61bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page