Contributing¶
Contributions are welcome. Here's how to get started.
Development Setup¶
git clone https://github.com/Mandark-droid/genai_otel_instrument.git
cd genai_otel_instrument
pip install -e ".[dev,all]"
Running Tests¶
# All tests with coverage
pytest tests/ -v --cov=genai_otel --cov-report=term
# Specific test file
pytest tests/test_config.py -v
# Specific instrumentor
pytest tests/instrumentors/test_openai_instrumentor.py -v
Code Quality¶
black genai_otel tests # Format (line length: 100)
isort genai_otel tests # Sort imports
pylint genai_otel # Lint
mypy genai_otel # Type check
Adding a New Instrumentor¶
- Create
genai_otel/instrumentors/{provider}_instrumentor.py - Inherit from
BaseInstrumentorand implementinstrument()and_extract_usage() - Add to
INSTRUMENTORSdict inauto_instrument.py - Add optional dependency to
pyproject.toml - Create tests in
tests/instrumentors/test_{provider}_instrumentor.py - Update
DEFAULT_INSTRUMENTORSinconfig.pyif enabled by default - Add pricing to
llm_pricing.json
Commit Messages¶
Use conventional commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentationtest:- Test changesrefactor:- Code refactoringchore:- Maintenance