Skip to content

Update span assessment

client.SpanAssessments.Update(ctx, spanAssessmentID, body) (*SpanAssessment, error)
PATCH/v5/span-assessments/{span_assessment_id}

Update the content of an existing span assessment.

Only the assessment’s original creator, or an account admin or manager, may update it; a request from any other identity returns 403. Supplied fields overwrite the stored values and the merged result is re-validated against the assessment’s type, so the content must stay consistent with assessment_type (the matching content field present and no conflicting fields set) or the call returns 422. The span and trace an assessment is attached to cannot be changed through this endpoint. Returns 404 if no assessment with that id exists for the caller’s account.

ParametersExpand Collapse
spanAssessmentID string
body SpanAssessmentUpdateParams
Approval param.Field[ApprovalStatus]Optional

Approval status (approved/rejected)

AssessmentType param.Field[AssessmentType]Optional

Type of assessment

Comment param.Field[string]Optional

Raw text feedback

Metadata param.Field[map[string, any]]Optional

Arbitrary JSON object for additional data

Overwrite param.Field[map[string, any]]Optional

User corrections to span output

Rating param.Field[int64]Optional

Numerical rating (1-5)

maximum5
minimum1
Rubric param.Field[map[string, string]]Optional

Rule key-value pairs for rubric evaluation

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

Update span assessment

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"),
  )
  spanAssessment, err := client.SpanAssessments.Update(
    context.TODO(),
    "span_assessment_id",
    sgpdev.SpanAssessmentUpdateParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", spanAssessment.AssessmentID)
}
{
  "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"
}
Returns Examples
{
  "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"
}