Skip to content

Commit ba9bf35

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/fix-wagtail-transaction-names' into fix-wagtail-transaction-names
2 parents 1f1d628 + 4095720 commit ba9bf35

46 files changed

Lines changed: 6189 additions & 1275 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,36 @@ NEW_RELIC_EXTENSIONS=true pip install -e .
8080
NEW_RELIC_EXTENSIONS=false pip install -e .
8181
```
8282

83+
84+
## Reading External Library Code
85+
86+
When you need to read the source of an instrumented third-party library — to verify an API signature, understand class internals, or trace how a wrapped method behaves — **always look in `.tox/` first**. Do not grep system Python paths, and do not run `pip install` into the project.
87+
88+
### Source Layout
89+
90+
External library source lives at:
91+
92+
```
93+
.tox/<env_name>/lib/python*/site-packages/<library>/
94+
```
95+
96+
Use a `python*` glob — the Python minor version (e.g., `python3.12`, `python3.14`) varies by env and is encoded in the env name itself (`-py312-`, `-py314-`).
97+
98+
### Lookup Procedure
99+
100+
1. **List existing envs**: `tox -l | grep <library>` (or `ls .tox/`). Built envs contain the library; the others are just names in `tox.ini`.
101+
2. **Pick a version**: Prefer the env suffixed with `latest` (e.g., `flasklatest`, `djangolatest`) for the newest upstream code. If multiple `*latest` envs exist at different Python versions, prefer the newest Python (e.g., `-py314-` over `-py312-`). If you need an older or specific library version (e.g., `flask0203`), pick the matching versioned env instead.
102+
3. **Build the env if it doesn't exist yet**: If the env appears in `tox.ini` but not in `.tox/`, generate it without running tests:
103+
```bash
104+
tox r -e <env_name> --notest
105+
```
106+
Use this same command to install any specific version you need — just pick the right env name.
107+
4. **If no env name covers the library at all**: Run `grep -i <library> tox.ini` to confirm. If genuinely absent from the test matrix, ask the user before adding a new env.
108+
109+
### Reading the newrelic Package
110+
111+
The Python Agent (`newrelic` package) is installed into every env's `site-packages` with either the full source or as an editable install (you'll see `__editable__.newrelic-*.pth` files). Do not read agent code from `.tox/` — always read it from the project source tree to avoid stale or cached versions.
112+
83113
## Architecture
84114

85115
### Core Components

.github/workflows/build-ci-image.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565

6666
- name: Set up Docker Buildx
6767
id: buildx
68-
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # 4.1.0
68+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # 4.2.0
6969

7070
# Lowercase image name and append -ci
7171
- name: Generate Image Name
@@ -75,7 +75,7 @@ jobs:
7575
7676
- name: Generate Docker Metadata (Tags and Labels)
7777
id: meta
78-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # 6.1.0
78+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # 6.2.0
7979
with:
8080
images: ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME }}
8181
flavor: |
@@ -90,15 +90,15 @@ jobs:
9090
type=ref,event=pr
9191
9292
- name: Login to GitHub Container Registry
93-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # 4.2.0
93+
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # 4.4.0
9494
with:
9595
registry: ghcr.io
9696
username: ${{ github.repository_owner }}
9797
password: ${{ secrets.GITHUB_TOKEN }}
9898

9999
- name: Build and Push Image by Digest
100100
id: build
101-
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # 7.2.0
101+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # 7.3.0
102102
with:
103103
context: .github/containers/ci
104104
platforms: ${{ matrix.platform }}
@@ -135,14 +135,14 @@ jobs:
135135
merge-multiple: true
136136

137137
- name: Login to GitHub Container Registry
138-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # 4.2.0
138+
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # 4.4.0
139139
with:
140140
registry: ghcr.io
141141
username: ${{ github.repository_owner }}
142142
password: ${{ secrets.GITHUB_TOKEN }}
143143

144144
- name: Set up Docker Buildx
145-
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # 4.1.0
145+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # 4.2.0
146146

147147
# Lowercase image name and append -ci
148148
- name: Generate Image Name
@@ -152,7 +152,7 @@ jobs:
152152
153153
- name: Generate Docker Metadata (Tags and Labels)
154154
id: meta
155-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # 6.1.0
155+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # 6.2.0
156156
with:
157157
images: ghcr.io/${{ steps.image-name.outputs.IMAGE_NAME }}
158158
flavor: |

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383

8484
- name: Setup QEMU
8585
if: runner.os == 'Linux'
86-
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # 4.1.0
86+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # 4.2.0
8787
with:
8888
platforms: arm64
8989

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ jobs:
301301
git fetch --tags origin
302302
303303
- name: Install uv
304-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
304+
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # 8.3.0
305305

306306
- name: Install Python
307307
run: |
@@ -370,7 +370,7 @@ jobs:
370370
git fetch --tags origin
371371
372372
- name: Install uv
373-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
373+
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # 8.3.0
374374

375375
- name: Install Python
376376
run: |

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ jobs:
6767

6868
- name: Upload Trivy scan results to GitHub Security tab
6969
if: ${{ github.event_name == 'schedule' }}
70-
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # 4.36.2
70+
uses: github/codeql-action/upload-sarif@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # 4.36.3
7171
with:
7272
sarif_file: "trivy-results.sarif"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ megalinter-reports/
1010
# Benchmarks
1111
.asv/
1212

13+
# LLM Cache Files
14+
.tiktoken_cache
15+
1316
# Byte-compiled / optimized / DLL files
1417
__pycache__/
1518
*.py[cod]

newrelic/config.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,6 +3189,27 @@ def _process_module_builtin_defaults():
31893189
"newrelic.hooks.mlmodel_autogen",
31903190
"instrument_autogen_agentchat_agents__assistant_agent",
31913191
)
3192+
_process_module_definition(
3193+
"google.adk.agents.llm_agent", "newrelic.hooks.mlmodel_googleadk", "instrument_googleadk_agents_llm_agent"
3194+
)
3195+
_process_module_definition(
3196+
"google.adk.agents.loop_agent", "newrelic.hooks.mlmodel_googleadk", "instrument_googleadk_agents_loop_agent"
3197+
)
3198+
_process_module_definition(
3199+
"google.adk.agents.parallel_agent",
3200+
"newrelic.hooks.mlmodel_googleadk",
3201+
"instrument_googleadk_agents_parallel_agent",
3202+
)
3203+
_process_module_definition(
3204+
"google.adk.agents.sequential_agent",
3205+
"newrelic.hooks.mlmodel_googleadk",
3206+
"instrument_googleadk_agents_sequential_agent",
3207+
)
3208+
_process_module_definition(
3209+
"google.adk.flows.llm_flows.functions",
3210+
"newrelic.hooks.mlmodel_googleadk",
3211+
"instrument_googleadk_flows_llm_flows_functions",
3212+
)
31923213
_process_module_definition(
31933214
"strands.agent.agent", "newrelic.hooks.mlmodel_strands", "instrument_strands_agent_agent"
31943215
)

0 commit comments

Comments
 (0)