-
Notifications
You must be signed in to change notification settings - Fork 235
Add observability features to speech-to-speech workshop #184
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: main
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
|
Contributor
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. Is this file required?
Author
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. it's optional - just minimizing what could accidently get dockerized |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Build artifacts | ||
| build/ | ||
| dist/ | ||
| *.egg-info/ | ||
| *.egg | ||
|
|
||
| # Python cache | ||
| __pycache__/ | ||
| __pycache__* | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
|
|
||
| # Virtual environments | ||
| .venv/ | ||
| .env | ||
| venv/ | ||
| env/ | ||
| ENV/ | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| .coverage* | ||
| htmlcov/ | ||
| .tox/ | ||
| *.cover | ||
| .hypothesis/ | ||
| .mypy_cache/ | ||
| .ruff_cache/ | ||
|
|
||
| # Development | ||
| *.log | ||
| *.bak | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
| .DS_Store | ||
|
|
||
| # IDEs | ||
| .vscode/ | ||
| .idea/ | ||
|
|
||
| # Version control | ||
| .git/ | ||
| .gitignore | ||
| .gitattributes | ||
|
|
||
| # Documentation | ||
| docs/ | ||
| *.md | ||
| !README.md | ||
|
|
||
| # CI/CD | ||
| .github/ | ||
| .gitlab-ci.yml | ||
| .travis.yml | ||
|
|
||
| # Project specific | ||
| tests/ | ||
|
|
||
| # Bedrock AgentCore specific - keep config but exclude runtime files | ||
| .bedrock_agentcore.yaml | ||
| .dockerignore | ||
|
|
||
| # Keep wheelhouse for offline installations | ||
| # wheelhouse/ |
|
Contributor
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. Is this required? Or it is generated by the deployment script? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # AWS OpenTelemetry Configuration | ||
| OTEL_PYTHON_DISTRO=aws_distro | ||
| OTEL_PYTHON_CONFIGURATOR=aws_configurator | ||
| # OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 | ||
| OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://xray.us-east-1.amazonaws.com/v1/traces" | ||
| OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf | ||
|
|
||
| # Service Identification | ||
| OTEL_RESOURCE_ATTRIBUTES=service.name=banking_local_agent | ||
| AGENT_OBSERVABILITY_ENABLED=true | ||
|
|
||
| # CloudWatch Integration | ||
| OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=bedrock-agentcore-observability,x-aws-log-stream=default,x-aws-metric-namespace=bedrock-agentcore | ||
|
|
||
| # Propagation and Sampling - Enabled for custom exporter | ||
| OTEL_PROPAGATORS=tracecontext,baggage,xray | ||
| OTEL_TRACES_SAMPLER=always_on | ||
| OTEL_BSP_SCHEDULE_DELAY=1000 | ||
| OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512 | ||
| OTEL_BSP_EXPORT_TIMEOUT=30000 | ||
|
|
||
| # Disable unwanted instrumentations | ||
| OTEL_PYTHON_DISABLED_INSTRUMENTATIONS="bedrock-agentcore,strands-agents,strands-agents-tools,boto3sqs,botocore,requests,urllib3,httpx,aiohttp-client,asyncio,threading,logging,system_metrics,psutil,sqlite3,redis,pymongo,sqlalchemy,django,flask,tornado,pyramid,falcon,starlette,fastapi,websockets" |
|
Contributor
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. Is this required? Or it is generated by the deployment script?
Author
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. that one was required as it sets some env variables influencing instrumentation. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | ||
| WORKDIR /app | ||
|
|
||
| # Configure UV for container environment | ||
| ENV UV_SYSTEM_PYTHON=1 UV_COMPILE_BYTECODE=1 | ||
|
|
||
|
|
||
|
|
||
| COPY requirements.txt requirements.txt | ||
| # Install from requirements file | ||
| RUN uv pip install -r requirements.txt | ||
|
|
||
|
|
||
|
|
||
|
|
||
| RUN uv pip install aws-opentelemetry-distro>=0.10.1 | ||
|
|
||
|
|
||
| # Set AWS region environment variable | ||
|
|
||
| ENV AWS_REGION=us-east-1 | ||
| ENV AWS_DEFAULT_REGION=us-east-1 | ||
|
|
||
|
|
||
| # Signal that this is running in Docker for host binding logic | ||
| ENV DOCKER_CONTAINER=1 | ||
|
|
||
| ENV OTEL_PYTHON_DISTRO=aws_distro | ||
| ENV OTEL_PYTHON_CONFIGURATOR=aws_configurator | ||
| ENV OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/traces | ||
| ENV OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf | ||
| ENV OTEL_RESOURCE_ATTRIBUTES=service.name={agent_name} | ||
| ENV AGENT_OBSERVABILITY_ENABLED=true | ||
| ENV OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=bedrock-agentcore-observability,x-aws-log-stream=default,x-aws-metric-namespace=bedrock-agentcore | ||
| ENV OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=bedrock-agentcore,strands-agents,strands-agents-tools,boto3sqs,botocore,requests,urllib3,httpx,aiohttp-client,asyncio,threading,logging,system_metrics,psutil,sqlite3,redis,pymongo,sqlalchemy,django,flask,tornado,pyramid,falcon,starlette,fastapi,websockets | ||
|
|
||
| # Create non-root user | ||
| RUN useradd -m -u 1000 bedrock_agentcore | ||
| USER bedrock_agentcore | ||
|
|
||
| EXPOSE 8080 | ||
| EXPOSE 8000 | ||
|
|
||
| # Copy entire project (respecting .dockerignore) | ||
| COPY . . | ||
|
|
||
| # Use the full module path | ||
|
|
||
| CMD ["opentelemetry-instrument", "python", "-m", "banking_agent"] |
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.
Could you move the Observability section to the agent-core folder? It’s mostly relevant to AgentCore integration.
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.
Which files explicitly?