Skip to content
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

Add LLM Observability to ListStreamSource #2732

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-16 20:07:12.155834",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 14:10:54.976689",
"spec_repo_commit": "fb024a45"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-16 20:07:12.175711",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 14:10:54.995137",
"spec_repo_commit": "fb024a45"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4796,6 +4796,7 @@ components:
- logs_transaction_stream
- event_stream
- rum_stream
- llm_observability_stream
example: apm_issue_stream
type: string
x-enum-varnames:
Expand All @@ -4811,6 +4812,7 @@ components:
- LOGS_TRANSACTION_STREAM
- EVENT_STREAM
- RUM_STREAM
- LLM_OBSERVABILITY_STREAM
ListStreamWidgetDefinition:
description: 'The list stream visualization displays a table of recent events
in your application that
Expand Down
26 changes: 14 additions & 12 deletions api/datadogV1/model_list_stream_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ type ListStreamSource string

// List of ListStreamSource.
const (
LISTSTREAMSOURCE_LOGS_STREAM ListStreamSource = "logs_stream"
LISTSTREAMSOURCE_AUDIT_STREAM ListStreamSource = "audit_stream"
LISTSTREAMSOURCE_CI_PIPELINE_STREAM ListStreamSource = "ci_pipeline_stream"
LISTSTREAMSOURCE_CI_TEST_STREAM ListStreamSource = "ci_test_stream"
LISTSTREAMSOURCE_RUM_ISSUE_STREAM ListStreamSource = "rum_issue_stream"
LISTSTREAMSOURCE_APM_ISSUE_STREAM ListStreamSource = "apm_issue_stream"
LISTSTREAMSOURCE_TRACE_STREAM ListStreamSource = "trace_stream"
LISTSTREAMSOURCE_LOGS_ISSUE_STREAM ListStreamSource = "logs_issue_stream"
LISTSTREAMSOURCE_LOGS_PATTERN_STREAM ListStreamSource = "logs_pattern_stream"
LISTSTREAMSOURCE_LOGS_TRANSACTION_STREAM ListStreamSource = "logs_transaction_stream"
LISTSTREAMSOURCE_EVENT_STREAM ListStreamSource = "event_stream"
LISTSTREAMSOURCE_RUM_STREAM ListStreamSource = "rum_stream"
LISTSTREAMSOURCE_LOGS_STREAM ListStreamSource = "logs_stream"
LISTSTREAMSOURCE_AUDIT_STREAM ListStreamSource = "audit_stream"
LISTSTREAMSOURCE_CI_PIPELINE_STREAM ListStreamSource = "ci_pipeline_stream"
LISTSTREAMSOURCE_CI_TEST_STREAM ListStreamSource = "ci_test_stream"
LISTSTREAMSOURCE_RUM_ISSUE_STREAM ListStreamSource = "rum_issue_stream"
LISTSTREAMSOURCE_APM_ISSUE_STREAM ListStreamSource = "apm_issue_stream"
LISTSTREAMSOURCE_TRACE_STREAM ListStreamSource = "trace_stream"
LISTSTREAMSOURCE_LOGS_ISSUE_STREAM ListStreamSource = "logs_issue_stream"
LISTSTREAMSOURCE_LOGS_PATTERN_STREAM ListStreamSource = "logs_pattern_stream"
LISTSTREAMSOURCE_LOGS_TRANSACTION_STREAM ListStreamSource = "logs_transaction_stream"
LISTSTREAMSOURCE_EVENT_STREAM ListStreamSource = "event_stream"
LISTSTREAMSOURCE_RUM_STREAM ListStreamSource = "rum_stream"
LISTSTREAMSOURCE_LLM_OBSERVABILITY_STREAM ListStreamSource = "llm_observability_stream"
)

var allowedListStreamSourceEnumValues = []ListStreamSource{
Expand All @@ -42,6 +43,7 @@ var allowedListStreamSourceEnumValues = []ListStreamSource{
LISTSTREAMSOURCE_LOGS_TRANSACTION_STREAM,
LISTSTREAMSOURCE_EVENT_STREAM,
LISTSTREAMSOURCE_RUM_STREAM,
LISTSTREAMSOURCE_LLM_OBSERVABILITY_STREAM,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down
89 changes: 89 additions & 0 deletions examples/v1/dashboards/CreateDashboard_3298564989.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Create a new dashboard with llm_observability_stream list_stream widget

package main

import (
"context"
"encoding/json"
"fmt"
"os"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)

func main() {
body := datadogV1.Dashboard{
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
Title: "Example-Dashboard with list_stream widget",
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM,
Requests: []datadogV1.ListStreamWidgetRequest{
{
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST,
Query: datadogV1.ListStreamQuery{
DataSource: datadogV1.LISTSTREAMSOURCE_LLM_OBSERVABILITY_STREAM,
QueryString: "@event_type:span @parent_id:undefined",
Indexes: []string{},
},
Columns: []datadogV1.ListStreamColumn{
{
Field: "@status",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_COMPACT,
},
{
Field: "@content.prompt",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "@content.response.content",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "timestamp",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "@ml_app",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "service",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "@meta.evaluations.quality",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "@meta.evaluations.security",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
{
Field: "@duration",
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
},
},
},
},
}},
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.CreateDashboard(ctx, body)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}

responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-15T21:46:06.749Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
interactions:
- request:
body: |
{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget-1729028766 with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"@status","width":"compact"},{"field":"@content.prompt","width":"auto"},{"field":"@content.response.content","width":"auto"},{"field":"timestamp","width":"auto"},{"field":"@ml_app","width":"auto"},{"field":"service","width":"auto"},{"field":"@meta.evaluations.quality","width":"auto"},{"field":"@meta.evaluations.security","width":"auto"},{"field":"@duration","width":"auto"}],"query":{"data_source":"llm_observability_stream","indexes":[],"query_string":"@event_type:span @parent_id:undefined"},"response_format":"event_list"}],"type":"list_stream"}}]}
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
id: 0
method: POST
url: https://api.datadoghq.com/api/v1/dashboard
response:
body: '{"id":"k3w-qcg-ug8","title":"Test-Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget-1729028766
with list_stream widget","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
Account","layout_type":"ordered","url":"/dashboard/k3w-qcg-ug8/test-createanewdashboardwithllmobservabilitystreamliststreamwidget-1729028766-wi","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"@status","width":"compact"},{"field":"@content.prompt","width":"auto"},{"field":"@content.response.content","width":"auto"},{"field":"timestamp","width":"auto"},{"field":"@ml_app","width":"auto"},{"field":"service","width":"auto"},{"field":"@meta.evaluations.quality","width":"auto"},{"field":"@meta.evaluations.security","width":"auto"},{"field":"@duration","width":"auto"}],"query":{"data_source":"llm_observability_stream","indexes":[],"query_string":"@event_type:span
@parent_id:undefined"},"response_format":"event_list"}],"type":"list_stream"},"id":8221646523831060}],"notify_list":null,"created_at":"2024-10-15T21:46:06.954265+00:00","modified_at":"2024-10-15T21:46:06.954265+00:00","restricted_roles":[]}

'
code: 200
duration: 0ms
headers:
Content-Type:
- application/json
status: 200 OK
- request:
body: ''
form: {}
headers:
Accept:
- application/json
id: 1
method: DELETE
url: https://api.datadoghq.com/api/v1/dashboard/k3w-qcg-ug8
response:
body: '{"deleted_dashboard_id":"k3w-qcg-ug8"}

'
code: 200
duration: 0ms
headers:
Content-Type:
- application/json
status: 200 OK
version: 2
8 changes: 8 additions & 0 deletions tests/scenarios/features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with llm_observability_stream list_stream widget
Given new "CreateDashboard" request
And body with value {"layout_type":"ordered","title":"{{ unique }} with list_stream widget","widgets":[{"definition":{"type":"list_stream","requests":[{"response_format":"event_list","query":{"data_source":"llm_observability_stream","query_string":"@event_type:span @parent_id:undefined","indexes":[]},"columns":[{"field":"@status","width":"compact"},{"field":"@content.prompt","width":"auto"},{"field":"@content.response.content","width":"auto"},{"field":"timestamp","width":"auto"},{"field":"@ml_app","width":"auto"},{"field":"service","width":"auto"},{"field":"@meta.evaluations.quality","width":"auto"},{"field":"@meta.evaluations.security","width":"auto"},{"field":"@duration","width":"auto"}]}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "llm_observability_stream"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with log_stream widget
Given new "CreateDashboard" request
Expand Down
Loading