Skip to content

[8.x] [GenAI Connectors] Add support for telemetry metadata (#208180)#210017

Closed
kibanamachine wants to merge 2 commits intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-208180
Closed

[8.x] [GenAI Connectors] Add support for telemetry metadata (#208180)#210017
kibanamachine wants to merge 2 commits intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-208180

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

This extends initial connector telemetry from PR ref
elastic#186936.

The PR adds the following optional fields when instantiating a new
actionClient as part of its `subActionParams`:

```ts
{
  telemetryMetadata : {
    pluginId: "your plugin name or unique identifier",
    aggregateBy: "ID to aggregate on"
  }
}
```

The support is added to all AI connector models for both
stream/non-stream/raw.

The PR also adds token count usage for bedrock `InvokeAIRaw`, as that
was currently not added correctly.

Pierre also helped with adding a new metadata optional field for the `NL
to ESQL functions`, so that users can pass in similar metadata for LLM
conversations using the InfereceClient.

PluginId is a field used to filter telemetry in the way the team wants
to implement it. It could be a team name, a plugin name etc, all
depending on how the team wants to group and filter on the telemetry
event.

AggregateBy is intended to be used to group multiple LLM calls for
aggregations and stats, for example a conversationId that has multiple
LLM calls.

Both fields are optional, so when you do not want to aggregate the
option can simply be ignored.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co>
(cherry picked from commit 3394b69)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Feb 6, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) February 6, 2025 14:31
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 6, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #6 / Connector type config checks detect connector type changes for: .inference
  • [job] [logs] Jest Integration Tests #6 / Connector type config checks detect connector type changes for: .inference

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/inference-common 59 62 +3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
inference 7.6KB 7.6KB +22.0B
Unknown metric groups

API count

id before after diff
@kbn/inference-common 174 180 +6

History

cc @P1llus

@P1llus P1llus closed this Feb 7, 2025
auto-merge was automatically disabled February 7, 2025 10:30

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants