Skip to content

Commit 5e78f3f

Browse files
committed
2 parents 2a516ea + dc85e4e commit 5e78f3f

File tree

7 files changed

+49
-61
lines changed

7 files changed

+49
-61
lines changed

ai-support.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"kind": "gateway",
44
"title": "Amazon Bedrock",
5-
"preamble": "Through the `@aws-sdk/client-bedrock-runtime` module, we support:",
5+
"preamble": "Through the `@aws-sdk/client-bedrock-runtime` module, we support all models (text-only) through the `Converse` API; for `InvokeModel` API, we support the following models:",
66
"footnote": "Note: if a model supports streaming, we also instrument the streaming variant.",
77
"models": [
88
{

compatibility.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ supported by the agent.
1212
| Package name | Minimum supported version | Latest published version | Introduced in* |
1313
| --- | --- | --- | --- |
1414
| `@apollo/gateway` | 2.3.0 | 2.11.2 | `@newrelic/apollo-server-plugin@1.0.0` |
15-
| `@apollo/server` | 4.0.0 | 4.12.2 | `@newrelic/apollo-server-plugin@2.1.0` |
16-
| `@aws-sdk/client-bedrock-runtime` | 3.474.0 | 3.842.0 | 11.13.0 |
17-
| `@aws-sdk/client-dynamodb` | 3.0.0 | 3.840.0 | 8.7.1 |
18-
| `@aws-sdk/client-sns` | 3.0.0 | 3.840.0 | 8.7.1 |
19-
| `@aws-sdk/client-sqs` | 3.0.0 | 3.840.0 | 8.7.1 |
20-
| `@aws-sdk/lib-dynamodb` | 3.377.0 | 3.840.0 | 8.7.1 |
15+
| `@apollo/server` | 4.0.0 | 5.0.0 | `@newrelic/apollo-server-plugin@2.1.0` |
16+
| `@aws-sdk/client-bedrock-runtime` | 3.474.0 | 3.848.0 | 11.13.0 |
17+
| `@aws-sdk/client-dynamodb` | 3.0.0 | 3.848.0 | 8.7.1 |
18+
| `@aws-sdk/client-sns` | 3.0.0 | 3.848.0 | 8.7.1 |
19+
| `@aws-sdk/client-sqs` | 3.0.0 | 3.848.0 | 8.7.1 |
20+
| `@aws-sdk/lib-dynamodb` | 3.377.0 | 3.850.0 | 8.7.1 |
2121
| `@aws-sdk/smithy-client` | 3.47.0 | 3.374.0 | 8.7.1 |
22-
| `@azure/functions` | 4.7.0 | 4.7.3-beta.0 | 12.18.0 |
22+
| `@azure/functions` | 4.7.0 | 4.7.2 | 12.18.0 |
2323
| `@elastic/elasticsearch` | 7.16.0 | 9.0.3 | 11.9.0 |
24-
| `@google/genai` | 1.1.0 | 1.8.0 | 12.21.0 |
24+
| `@google/genai` | 1.1.0 | 1.10.0 | 12.21.0 |
2525
| `@grpc/grpc-js` | 1.4.0 | 1.13.4 | 8.17.0 |
2626
| `@hapi/hapi` | 20.1.2 | 21.4.0 | 9.0.0 |
2727
| `@koa/router` | 11.0.2 | 13.1.1 | 3.2.0 |
28-
| `@langchain/core` | 0.1.17 | 0.3.62 | 11.13.0 |
28+
| `@langchain/core` | 0.1.17 | 0.3.66 | 11.13.0 |
2929
| `@nestjs/cli` | 9.0.0 | 11.0.7 | 10.1.0 |
3030
| `@opensearch-project/opensearch` | 2.1.0 | 3.5.1 | 12.10.0 |
31-
| `@prisma/client` | 5.0.0 | 6.11.1 | 11.0.0 |
32-
| `@smithy/smithy-client` | 2.0.0 | 4.4.6 | 11.0.0 |
31+
| `@prisma/client` | 5.0.0 | 6.12.0 | 11.0.0 |
32+
| `@smithy/smithy-client` | 2.0.0 | 4.4.8 | 11.0.0 |
3333
| `amqplib` | 0.5.0 | 0.10.8 | 2.0.0 |
3434
| `apollo-server` | 3.0.0 | 3.13.0 | `@newrelic/apollo-server-plugin@1.0.0` |
3535
| `apollo-server-express` | 3.0.0 | 3.13.0 | `@newrelic/apollo-server-plugin@1.0.0` |
@@ -49,17 +49,17 @@ supported by the agent.
4949
| `memcached` | 2.2.0 | 2.2.2 | 1.26.2 |
5050
| `mongodb` | 4.1.4 | 6.17.0 | 1.32.0 |
5151
| `mysql` | 2.16.0 | 2.18.1 | 1.32.0 |
52-
| `mysql2` | 2.0.0 | 3.14.1 | 1.32.0 |
53-
| `next` | 13.4.19 | 15.3.5 | 12.0.0 |
54-
| `openai` | 4.0.0 | 5.8.3 | 11.13.0 |
52+
| `mysql2` | 2.0.0 | 3.14.2 | 1.32.0 |
53+
| `next` | 13.4.19 | 15.4.2 | 12.0.0 |
54+
| `openai` | 4.0.0 | 5.10.1 | 11.13.0 |
5555
| `pg` | 8.2.0 | 8.16.3 | 9.0.0 |
5656
| `pg-native` | 3.0.0 | 3.5.2 | 9.0.0 |
5757
| `pino` | 7.0.0 | 9.7.0 | 8.11.0 |
5858
| `q` | 1.3.0 | 1.5.1 | 1.26.2 |
5959
| `redis` | 3.1.0 | 5.6.0 | 1.31.0 |
6060
| `restify` | 11.0.0 | 11.1.0 | 2.6.0 |
6161
| `superagent` | 3.0.0 | 10.2.2 | 4.9.0 |
62-
| `undici` | 5.0.0 | 7.11.0 | 11.1.0 |
62+
| `undici` | 5.0.0 | 7.12.0 | 11.1.0 |
6363
| `when` | 3.7.0 | 3.7.8 | 1.26.2 |
6464
| `winston` | 3.0.0 | 3.17.0 | 8.11.0 |
6565

@@ -71,7 +71,7 @@ The Node.js agent supports the following AI platforms and integrations.
7171

7272
### Amazon Bedrock
7373

74-
Through the `@aws-sdk/client-bedrock-runtime` module, we support:
74+
Through the `@aws-sdk/client-bedrock-runtime` module, we support all models (text-only) through the `Converse` API; for `InvokeModel` API, we support the following models:
7575

7676
| Model | Image | Text | Vision |
7777
| --- | --- | --- | --- |

test/integration/instrumentation/http-outbound.test.js

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const helper = require('../../lib/agent_helper')
99
const test = require('node:test')
1010
const assert = require('node:assert')
1111
const symbols = require('../../../lib/symbols')
12+
const nock = require('nock')
1213

1314
test('external requests', async function (t) {
1415
t.beforeEach((ctx) => {
@@ -159,42 +160,15 @@ test('external requests', async function (t) {
159160
})
160161
})
161162

162-
await t.test('should not duplicate the external segment', function (t, end) {
163-
const { agent } = t.nr
164-
const https = require('https')
165-
166-
helper.runInTransaction(agent, function inTransaction() {
167-
https.get('https://example.com:443/', function onResponse(res) {
168-
res.once('end', check)
169-
res.resume()
170-
})
171-
})
172-
173-
function check() {
174-
const tx = agent.getTransaction()
175-
const [segment] = tx.trace.getChildren(tx.trace.root.id)
176-
177-
assert.equal(segment.name, 'External/example.com/', 'should be named')
178-
assert.ok(segment.timer.start, 'should have started')
179-
assert.ok(segment.timer.hasEnd(), 'should have ended')
180-
const segmentChildren = tx.trace.getChildren(segment.id)
181-
assert.equal(segmentChildren.length, 1, 'should have 1 child')
182-
183-
const notDuped = segmentChildren[0]
184-
assert.notEqual(
185-
notDuped.name,
186-
segment.name,
187-
'child should not be named the same as the external segment'
188-
)
189-
190-
end()
191-
}
192-
})
193-
194163
await t.test('NODE-1647 should not interfere with `got`', { timeout: 5000 }, function (t, end) {
195164
const { agent } = t.nr
196165
// Our way of wrapping HTTP response objects caused `got` to hang. This was
197166
// resolved in agent 2.5.1.
167+
nock.disableNetConnect()
168+
t.after(() => {
169+
nock.enableNetConnect()
170+
})
171+
nock('https://example.com').get('/').reply(200)
198172
const got = require('got')
199173
helper.runInTransaction(agent, function () {
200174
const req = got('https://example.com/')
@@ -215,8 +189,13 @@ test('external requests', async function (t) {
215189

216190
await t.test('should record requests to default ports', (t, end) => {
217191
const { agent, http } = t.nr
192+
nock.disableNetConnect()
193+
t.after(() => {
194+
nock.enableNetConnect()
195+
})
196+
nock('http://example.com').get('/').reply(200)
218197
helper.runInTransaction(agent, (tx) => {
219-
http.get('http://example.com', (res) => {
198+
http.get('http://example.com/', (res) => {
220199
res.resume()
221200
res.on('end', () => {
222201
const [segment] = tx.trace.getChildren(tx.trace.root.id)
@@ -229,9 +208,14 @@ test('external requests', async function (t) {
229208

230209
await t.test('should expose the external segment on the http request', (t, end) => {
231210
const { agent, http } = t.nr
211+
nock.disableNetConnect()
212+
t.after(() => {
213+
nock.enableNetConnect()
214+
})
215+
nock('http://example.com').get('/').reply(200)
232216
helper.runInTransaction(agent, (tx) => {
233217
let reqSegment = null
234-
const req = http.get('http://example.com', (res) => {
218+
const req = http.get('http://example.com/', (res) => {
235219
res.resume()
236220
res.on('end', () => {
237221
const [segment] = tx.trace.getChildren(tx.trace.root.id)

test/unit/spans/span-event.test.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ const assert = require('node:assert')
88
const test = require('node:test')
99
const DatastoreShim = require('../../../lib/shim/datastore-shim')
1010
const helper = require('../../lib/agent_helper')
11-
const https = require('https')
11+
const http = require('http')
1212
const SpanEvent = require('../../../lib/spans/span-event')
1313
const DatastoreParameters = require('../../../lib/shim/specs/params/datastore')
1414
const { QuerySpec } = require('../../../lib/shim/specs')
15+
const nock = require('nock')
1516

1617
test('#constructor() should construct an empty span event', () => {
1718
const attrs = {}
@@ -43,6 +44,7 @@ test('#constructor() should construct an empty span event', () => {
4344

4445
test('fromSegment()', async (t) => {
4546
t.beforeEach((ctx) => {
47+
nock.disableNetConnect()
4648
ctx.nr = {}
4749
ctx.nr.agent = helper.instrumentMockedAgent({
4850
distributed_tracing: {
@@ -52,6 +54,7 @@ test('fromSegment()', async (t) => {
5254
})
5355

5456
t.afterEach((ctx) => {
57+
nock.enableNetConnect()
5558
helper.unloadAgent(ctx.nr.agent)
5659
})
5760

@@ -132,8 +135,9 @@ test('fromSegment()', async (t) => {
132135
helper.runInTransaction(agent, (transaction) => {
133136
transaction.sampled = true
134137
transaction.priority = 42
138+
nock('http://example.com').get('/?foo=bar').reply(200)
135139

136-
https.get('https://example.com?foo=bar', (res) => {
140+
http.get('http://example.com?foo=bar', (res) => {
137141
res.resume()
138142
res.on('end', () => {
139143
const tx = agent.tracer.getTransaction()
@@ -159,7 +163,7 @@ test('fromSegment()', async (t) => {
159163
assert.equal(span.intrinsics.name, 'External/example.com/')
160164
assert.equal(span.intrinsics.timestamp, segment.timer.start)
161165

162-
assert.ok(span.intrinsics.duration >= 0.01 && span.intrinsics.duration <= 2)
166+
assert.ok(span.intrinsics.duration > 0 && span.intrinsics.duration <= 2)
163167

164168
// Should have type-specific intrinsics
165169
assert.equal(span.intrinsics.component, 'http')
@@ -169,13 +173,12 @@ test('fromSegment()', async (t) => {
169173
const attributes = span.attributes
170174

171175
// Should have (most) http properties.
172-
assert.equal(attributes['http.url'], 'https://example.com/')
176+
assert.equal(attributes['http.url'], 'http://example.com/')
173177
assert.equal(attributes['server.address'], 'example.com')
174-
assert.equal(attributes['server.port'], 443)
178+
assert.equal(attributes['server.port'], 80)
175179
assert.ok(attributes['http.method'])
176180
assert.ok(attributes['http.request.method'])
177181
assert.equal(attributes['http.statusCode'], 200)
178-
assert.equal(attributes['http.statusText'], 'OK')
179182

180183
// should nullify mapped properties
181184
assert.ok(!attributes.library)
@@ -353,8 +356,9 @@ test('fromSegment()', async (t) => {
353356

354357
await t.test('should handle truncated http spans', (t, end) => {
355358
const { agent } = t.nr
359+
nock('http://www.example.com').get('/path?foo=bar').reply(200)
356360
helper.runInTransaction(agent, (transaction) => {
357-
https.get('https://example.com?foo=bar', (res) => {
361+
http.get('http://www.example.com/path?foo=bar', (res) => {
358362
transaction.end() // prematurely end to truncate
359363

360364
res.resume()

test/versioned/langchain/runnables-streaming.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async function beforeEach({ enabled, ctx }) {
4444

4545
ctx.nr.prompt = ChatPromptTemplate.fromMessages([['assistant', '{topic} response']])
4646
ctx.nr.model = new ChatOpenAI({
47-
openAIApiKey: 'fake-key',
47+
apiKey: 'fake-key',
4848
maxRetries: 0,
4949
configuration: {
5050
baseURL: `http://${host}:${port}`

test/versioned/langchain/runnables.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test.beforeEach(async (ctx) => {
3838

3939
ctx.nr.prompt = ChatPromptTemplate.fromMessages([['assistant', 'You are a {topic}.']])
4040
ctx.nr.model = new ChatOpenAI({
41-
openAIApiKey: 'fake-key',
41+
apiKey: 'fake-key',
4242
maxRetries: 0,
4343
configuration: {
4444
baseURL: `http://${host}:${port}`

test/versioned/langchain/vectorstore.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test.beforeEach(async (ctx) => {
4545
const { ElasticVectorSearch } = require('@langchain/community/vectorstores/elasticsearch')
4646

4747
ctx.nr.embedding = new OpenAIEmbeddings({
48-
openAIApiKey: 'fake-key',
48+
apiKey: 'fake-key',
4949
configuration: {
5050
baseURL: `http://${host}:${port}`
5151
}

0 commit comments

Comments
 (0)