Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/dataset/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# Hatch
.hatch/

# Environment files - NEVER commit actual secrets!
.envrc
.envrc.local
.env
.env.local

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
UnauthorizedError,
)

# Add parent directory to path to import basalt
project_root = Path(__file__).parent.parent
# Add repo root to path to import basalt
project_root = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(project_root))

os.environ["BASALT_BUILD"] = "development"
Expand Down
20 changes: 20 additions & 0 deletions examples/dataset/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "basalt-dataset-example"
version = "0.1.0"
description = "Dataset API examples for Basalt"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []

[tool.hatch.envs.default]
detached = true
dependencies = [
"httpx>=0.25.0",
]

[tool.hatch.envs.default.scripts]
run = "python dataset_api_example.py"
39 changes: 39 additions & 0 deletions examples/dataset/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Check if direnv is loaded
if [ -z "$BASALT_API_KEY" ]; then
echo -e "${RED}Error: Environment not loaded.${NC}"
echo "Please run: ${YELLOW}direnv allow${NC}"
echo "Then edit .envrc with your Basalt API key"
exit 1
fi

echo -e "${GREEN}Environment loaded successfully${NC}"
echo "BASALT_ENVIRONMENT: $BASALT_ENVIRONMENT"
echo "BASALT_SERVICE_NAME: $BASALT_SERVICE_NAME"
echo ""

# Change to the script directory
cd "$(dirname "$0")"

# Check if hatch environment exists
if ! hatch env show default &>/dev/null; then
echo -e "${YELLOW}Creating hatch environment...${NC}"
hatch env create
fi

# Install basalt-py from parent directory
echo -e "${YELLOW}Installing basalt-py from parent directory...${NC}"
hatch run pip install -q -e ../..

echo -e "${GREEN}Running dataset example...${NC}"
echo ""

hatch run run
39 changes: 39 additions & 0 deletions examples/gemini_simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# Hatch
.hatch/

# Environment files - NEVER commit actual secrets!
.envrc
.envrc.local
.env
.env.local

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/
22 changes: 22 additions & 0 deletions examples/gemini_simple/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "basalt-gemini-simple-example"
version = "0.1.0"
description = "Simple Gemini example demonstrating Basalt observability"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []

[tool.hatch.envs.default]
detached = true
dependencies = [
"google-genai==1.60.0",
"httpx>=0.25.0",
"opentelemetry-exporter-otlp-proto-grpc~=1.39.1",
]

[tool.hatch.envs.default.scripts]
run = "python gemini_random_data_example.py"
39 changes: 39 additions & 0 deletions examples/gemini_simple/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Check if direnv is loaded
if [ -z "$BASALT_API_KEY" ]; then
echo -e "${RED}Error: Environment not loaded.${NC}"
echo "Please run: ${YELLOW}direnv allow${NC}"
echo "Then edit .envrc with your Basalt API key"
exit 1
fi

echo -e "${GREEN}Environment loaded successfully${NC}"
echo "BASALT_ENVIRONMENT: $BASALT_ENVIRONMENT"
echo "BASALT_SERVICE_NAME: $BASALT_SERVICE_NAME"
echo ""

# Change to the script directory
cd "$(dirname "$0")"

# Check if hatch environment exists
if ! hatch env show default &>/dev/null; then
echo -e "${YELLOW}Creating hatch environment...${NC}"
hatch env create
fi

# Install basalt-py from parent directory
echo -e "${YELLOW}Installing basalt-py from parent directory...${NC}"
hatch run pip install -q -e ../..

echo -e "${GREEN}Running Gemini example...${NC}"
echo ""

hatch run run
39 changes: 39 additions & 0 deletions examples/multi_exporter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# Hatch
.hatch/

# Environment files - NEVER commit actual secrets!
.envrc
.envrc.local
.env
.env.local

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/
21 changes: 21 additions & 0 deletions examples/multi_exporter/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "basalt-multi-exporter-example"
version = "0.1.0"
description = "Multi-exporter example demonstrating Basalt observability"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []

[tool.hatch.envs.default]
detached = true
dependencies = [
"opentelemetry-exporter-otlp-proto-grpc~=1.39.1",
"opentelemetry-sdk~=1.39.1",
]

[tool.hatch.envs.default.scripts]
run = "python multi_exporter_example.py"
39 changes: 39 additions & 0 deletions examples/multi_exporter/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Check if direnv is loaded
if [ -z "$BASALT_API_KEY" ]; then
echo -e "${RED}Error: Environment not loaded.${NC}"
echo "Please run: ${YELLOW}direnv allow${NC}"
echo "Then edit .envrc with your Basalt API key"
exit 1
fi

echo -e "${GREEN}Environment loaded successfully${NC}"
echo "BASALT_ENVIRONMENT: $BASALT_ENVIRONMENT"
echo "BASALT_SERVICE_NAME: $BASALT_SERVICE_NAME"
echo ""

# Change to the script directory
cd "$(dirname "$0")"

# Check if hatch environment exists
if ! hatch env show default &>/dev/null; then
echo -e "${YELLOW}Creating hatch environment...${NC}"
hatch env create
fi

# Install basalt-py from parent directory
echo -e "${YELLOW}Installing basalt-py from parent directory...${NC}"
hatch run pip install -q -e ../..

echo -e "${GREEN}Running multi-exporter example...${NC}"
echo ""

hatch run run
39 changes: 39 additions & 0 deletions examples/openai_simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Virtual environments
venv/
env/
ENV/

# Hatch
.hatch/

# Environment files - NEVER commit actual secrets!
.envrc
.envrc.local
.env
.env.local

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/
File renamed without changes.
21 changes: 21 additions & 0 deletions examples/openai_simple/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "basalt-openai-simple-example"
version = "0.1.0"
description = "Simple OpenAI example demonstrating Basalt observability"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []

[tool.hatch.envs.default]
detached = true
dependencies = [
"openai==2.15.0",
"opentelemetry-exporter-otlp-proto-grpc~=1.39.1",
]

[tool.hatch.envs.default.scripts]
run = "python openai_example.py"
Loading