Skip to content

List span or trace assessments

client.SpanAssessments.List(ctx, query) (*APIListPage[SpanAssessment], error)
GET/v5/span-assessments

Return the assessments attached to a given span or trace.

Results are scoped to the caller’s account. Exactly one of span_id or trace_id must be supplied as a query parameter, and a request providing neither returns 400. Filtering by trace_id returns assessments across every span of that trace, whereas span_id returns only that span’s assessments; an optional assessment_type narrows the results to a single type. Use the get-by-id endpoint when you already have a specific assessment id.

ParametersExpand Collapse
query SpanAssessmentListParams
AssessmentType param.Field[AssessmentType]Optional

Filter by assessment type

SpanID param.Field[string]Optional

Filter by span ID. Either span_id or trace_id must be provided as a query parameter.

TraceID param.Field[string]Optional

Filter by trace ID. Either span_id or trace_id must be provided as a query parameter.

ReturnsExpand Collapse
type SpanAssessment struct{…}

Response model for span assessment

AssessmentID string

Unique identifier for the assessment

AssessmentType AssessmentType

Type of assessment

One of the following:
const AssessmentTypeComment AssessmentType = "comment"
const AssessmentTypeRating AssessmentType = "rating"
const AssessmentTypeApproval AssessmentType = "approval"
const AssessmentTypeRubric AssessmentType = "rubric"
const AssessmentTypeMetadata AssessmentType = "metadata"
const AssessmentTypeOverwrite AssessmentType = "overwrite"
CreatedBy string

User who submitted the assessment

SpanID string

The span this assessment is attached to

TraceID string

The trace this assessment is attached to

AccountID stringOptional

Account this assessment belongs to

Approval ApprovalStatusOptional

Approval status (approved/rejected)

One of the following:
const ApprovalStatusApproved ApprovalStatus = "approved"
const ApprovalStatusRejected ApprovalStatus = "rejected"
Comment stringOptional

Raw text feedback

CreatedAt TimeOptional

When this assessment was created

formatdate-time
Metadata map[string, any]Optional

Arbitrary JSON object for additional data

Object SpanAssessmentObjectOptional
Overwrite map[string, any]Optional

User corrections to span output

Rating int64Optional

Numerical rating (1-5)

maximum5
minimum1
Rubric map[string, string]Optional

Rule key-value pairs for rubric evaluation

UpdatedAt TimeOptional

When this assessment was last updated

formatdate-time

List span or trace assessments

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  page, err := client.SpanAssessments.List(context.TODO(), sgpdev.SpanAssessmentListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "items": [
    {
      "assessment_id": "assessment_id",
      "assessment_type": "comment",
      "created_by": "created_by",
      "span_id": "span_id",
      "trace_id": "trace_id",
      "account_id": "account_id",
      "approval": "approved",
      "comment": "comment",
      "created_at": "2019-12-27T18:11:19.117Z",
      "metadata": {
        "foo": "bar"
      },
      "object": "span.assessment",
      "overwrite": {
        "foo": "bar"
      },
      "rating": 1,
      "rubric": {
        "foo": "string"
      },
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "object": "list"
}
Returns Examples
{
  "items": [
    {
      "assessment_id": "assessment_id",
      "assessment_type": "comment",
      "created_by": "created_by",
      "span_id": "span_id",
      "trace_id": "trace_id",
      "account_id": "account_id",
      "approval": "approved",
      "comment": "comment",
      "created_at": "2019-12-27T18:11:19.117Z",
      "metadata": {
        "foo": "bar"
      },
      "object": "span.assessment",
      "overwrite": {
        "foo": "bar"
      },
      "rating": 1,
      "rubric": {
        "foo": "string"
      },
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "object": "list"
}