mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-10-27 07:34:12 +08:00
All public APIs now live in one tree, with a version in every package, so a future version can sit next to v1. * Proto packages are `substrate.<api-name>.v1`, so gRPC method names change, for example to `/substrate.ateapi.v1.Control/GetActor`. * Go packages for the protos are named after the API, for example `package ateapi`. * CRDs move from `ate.dev/v1alpha1` to `ate.dev/v1`. They live in `api/infra/k8s/ate/v1`. AI use: AI-assisted, I reviewed and tested it (test automation). Fixes #2753
38 lines
1.4 KiB
Go
38 lines
1.4 KiB
Go
// Copyright 2026 Google LLC
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package controlapi
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/otel/trace"
|
|
|
|
"go.ate.dev/substrate/api/ateapi/v1"
|
|
"go.ate.dev/substrate/internal/ateattr"
|
|
"go.ate.dev/substrate/internal/resources"
|
|
)
|
|
|
|
// setSpanActorAttributes annotates the RPC's server span (from ctx) with the
|
|
// actor's full identity. A no-op when ctx carries no recording span.
|
|
func setSpanActorAttributes(ctx context.Context, a *ateapi.Actor) {
|
|
trace.SpanFromContext(ctx).SetAttributes(ateattr.ActorAttributes(a)...)
|
|
}
|
|
|
|
// setSpanActorRefAttributes is setSpanActorAttributes for the identity subset known
|
|
// before the Actor record resolves, so a failed lookup still carries who/where.
|
|
func setSpanActorRefAttributes(ctx context.Context, actorRef resources.ActorRef) {
|
|
trace.SpanFromContext(ctx).SetAttributes(ateattr.ActorRefAttributes(actorRef)...)
|
|
}
|