Documentation
¶
Overview ¶
Package logging is the service's log: JSON lines on one stream, in the keys Cloud Logging reads, held to the table of events in events.go.
Every line goes through guard, which writes only what the table allows. So the rule that the log carries no direct identifier, IP address, work, reading or hint text (R09 spec; privacy 4 spec) does not rest on each line's author remembering it: a field the table does not give the event is dropped and counted, and an event the table does not know loses its message. The libraries in the process — tutor, module-kit and the rest — are handed this same *slog.Logger, and their lines pass the same guard.
Index ¶
Constants ¶
const ( // EventStartup is the line that says a revision has started, which build it // runs, and what it declared for admission to AI (R25, R45). The delivery // finds a revision's release by it. EventStartup = "startup" // EventStopping is the line that says a stop was asked for. EventStopping = "stopping" // EventStopped is the line that says the server has drained. EventStopped = "stopped" // EventShutdown is the last line of a process that stopped as asked. EventShutdown = "shutdown" // EventFailure is a failure nobody asked for, at a moment of the closed set // the field moment names, and in the daily job, at which of its steps. EventFailure = "failure" // EventPanic is a panic a handler raised and the server recovered. EventPanic = "panic" // EventMigrated is the line that says the migrations of a database ran: how many // it applied, the version the schema is at, and, for the rights', whether it // made the store and wrote the model. EventMigrated = "migrated" // EventRequest is the line of a request of the protocol: its method, its code, // the cause of a refusal, the class of a refused token, how long it ran and, // when it failed, the kind of the failure — never its body, headers, address // or an ID (R18, R33). The path of a Connect GET holds the message, so the // method is written, not the path. EventRequest = "request" // EventSwept is the line of a step of the daily job (R21): which step, how many // it did and failed, and whether it went to its end — counts alone, never an // ID of what it did them to. EventSwept = "swept" // EventPackagesLaid is the line of api packages that laid the packages of the // pinned release of modules into a folder (R07, R41): the release, and how many // packages and files of their device parts it laid. EventPackagesLaid = "packages_laid" // EventPackageFile is the line of a request for a file of a device part, which // is no method of Connect (R18, R42): its HTTP status, how long it ran and, when // it failed, the kind of the failure — never its path, which names the package // and the file. EventPackageFile = "package_file" // EventAdmission is the line of api check that says what it found the // deployment to declare for admission to AI (R25, R45): the version of the // table, whether a file of facts was given, and the least stage and whether it // was named, so that the operator sees what is missing — never a provider, a // fact or a path. EventAdmission = "admission" // EventAIUsage is the line of what one model of a call of AI took, beside the // line of the request that made the call (R12, R46): the method, the provider // and the model, its tokens, how the call ended and how long it took — never // the work, what was read or what failed in its words. EventAIUsage = "ai_usage" )
The events of the service's own lines.
const ( FieldVersion = "version" FieldCommit = "commit" FieldDate = "date" FieldPort = "port" FieldDeployed = "deployed" FieldStarted = "started" FieldCutShort = "cut_short" FieldMoment = "moment" FieldErrorKind = "error_kind" FieldPanicKind = "panic_kind" FieldApplied = "applied" FieldSchemaVersion = "schema_version" FieldDatabase = "database" FieldStoreCreated = "store_created" FieldModelWritten = "model_written" FieldMethod = "method" FieldCode = "code" FieldCause = "cause" FieldTokenClass = "token_class" FieldDurationMS = "duration_ms" FieldStep = "step" FieldDone = "done" FieldFailed = "failed" FieldFinished = "finished" // FieldModulesRelease is the release of modules that modules.json pins. FieldModulesRelease = "modules_release" FieldPackages = "packages" FieldFiles = "files" // FieldStatus is the HTTP status of an answer. FieldStatus = "status" // FieldAdmissionTable is the version of the admission table, MAJOR.MINOR. FieldAdmissionTable = "admission_table" // FieldFactsFile says whether the deployment named a file of facts. FieldFactsFile = "facts_file" // FieldRung is the least stage of the rule of admission of models. FieldRung = "rung" // FieldRungSet says whether the deployment named the stage, rather than // taking full by default. FieldRungSet = "rung_set" // FieldPlatformKeys is how many providers the platform holds a key of. FieldPlatformKeys = "platform_keys" // FieldOutcomeCause is the cause of the outcome of an answer that was no // refusal: a call of AI that gave no reading. FieldOutcomeCause = "outcome_cause" // FieldProvider is a provider of AI, by its code in the admission table. FieldProvider = "provider" // FieldModel is a model of a provider, by the ID the provider answered with. FieldModel = "model" FieldInputTokens = "input_tokens" FieldOutputTokens = "output_tokens" FieldThinkingTokens = "thinking_tokens" // FieldAIOutcome is how a call of AI ended, in a word of AIOutcomes. FieldAIOutcome = "ai_outcome" )
The fields.
const ( MomentStartup = "startup" MomentServe = "serve" MomentShutdown = "shutdown" MomentMigrate = "migrate" MomentInvite = "invite" MomentCountries = "countries" MomentSweep = "sweep" MomentPackages = "packages" )
The moments of a failure: the value set of FieldMoment.
const ( StepMarks = "marks" StepIdleAccounts = "idle_accounts" StepIdleProfiles = "idle_profiles" StepAbandonedAttempts = "abandoned_attempts" StepAbandonedRuns = "abandoned_runs" StepUsers = "users" StepTuples = "tuples" StepConsentRecords = "consent_records" StepKeys = "keys" StepChangelog = "changelog" )
The steps of the daily job: the value set of FieldStep.
const ( DatabaseAPI = "api" DatabaseOpenFGA = "openfga" )
The databases api migrates: the value set of FieldDatabase.
Variables ¶
var AIOutcomes = []string{"answered", "failed", "limit_reached", "not_admitted", "key_refused"}
AIOutcomes is the value set of FieldAIOutcome: how a call of tutor ended, in tutor's kinds (R46).
var Codes = []string{
"ok", "canceled", "unknown", "invalid_argument", "deadline_exceeded", "not_found",
"already_exists", "permission_denied", "resource_exhausted", "failed_precondition",
"aborted", "out_of_range", "unimplemented", "internal", "unavailable", "data_loss",
"unauthenticated",
}
Codes is the value set of FieldCode: Connect's codes in Connect's words, and ok for a request that was not refused.
var Providers = []string{"anthropic", "google", "openai"}
Providers is the value set of FieldProvider: the providers of the admission table, by their codes (R96 spec). admission's tests hold the set to the table.
var Rungs = []string{"author", "full"}
Rungs is the value set of FieldRung: the stages of tutor's rule of admission of models, in tutor's codes (R25). admission's tests hold the set to config's.
var Steps = []string{StepMarks, StepIdleAccounts, StepIdleProfiles, StepAbandonedAttempts, StepAbandonedRuns, StepUsers, StepTuples, StepConsentRecords, StepKeys, StepChangelog}
Steps is every step of the daily job, in the order it takes them.
var TokenClasses = []string{"expired", "invalid", "revoked", "no_user", "disabled", "failed"}
TokenClasses is the value set of FieldTokenClass: the classes of a refused token, in authn's words (R20, R32).
Functions ¶
Types ¶
type Kind ¶
type Kind struct {
// contains filtered or unexported fields
}
Kind names what an error or a panic is, and none of what it carries: its text may hold a path, an address, a value from a request. Only ErrorKind and PanicKind make one, and the table accepts no other value for the fields error_kind and panic_kind.
func ErrorKind ¶
ErrorKind names an error by its chain, outermost first: the type of each link, a sentinel of the standard library by its name, and an errno of the system in the system's own words, which hold no data. The text of any other link is not written, since an error made by fmt.Errorf holds whatever its author formatted into it.
func PanicKind ¶
PanicKind names what a panic was raised with. A fault of the Go runtime is put in the runtime's own words, found inside whatever wrapped it, because those words hold types and numbers and no data. Anything else is a value of ours or a library's, which may hold a task, an answer or an image, so only its type is written.