newrelic
Version:
New Relic agent
30 lines (24 loc) • 784 B
JavaScript
/*
* Copyright 2025 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
const BaseEvent = require('../event')
const { makeId } = require('../../util/hashes')
module.exports = class LlmEvent extends BaseEvent {
constructor({ agent, segment, request, response, responseAttrs = false, transaction }) {
super()
this.id = makeId(36)
this.appName = agent.config.applications()[0]
this.trace_id = transaction?.traceId
this.span_id = segment?.id
this['response.model'] = response?.modelVersion
this['request.model'] = request?.model
this.vendor = 'gemini'
this.ingest_source = 'Node'
this.metadata = agent
if (responseAttrs) {
this.duration = segment?.getDurationInMillis()
}
}
}