lahirujayathilake commented on code in PR #489: URL: https://github.com/apache/airavata-custos/pull/489#discussion_r3376894689
########## pkg/models/trace.go: ########## @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 models + +import ( + "encoding/hex" + "encoding/json" + "time" +) + +type TraceSummary struct { + TraceID []byte `db:"trace_id" json:"-"` + RootOperation string `db:"root_operation" json:"root_operation"` + Source string `db:"source" json:"source"` + Status string `db:"status" json:"status"` + StartedAt time.Time `db:"started_at" json:"started_at"` + EndedAt time.Time `db:"ended_at" json:"ended_at"` + EventCount int `db:"event_count" json:"event_count"` +} + +func (t TraceSummary) MarshalJSON() ([]byte, error) { + type alias TraceSummary + return json.Marshal(struct { + TraceID string `json:"trace_id"` + alias + }{ + TraceID: hex.EncodeToString(t.TraceID), + alias: alias(t), + }) +} + Review Comment: - SpanID - unique 16-hex ID for an event - ParentSpanID - the SpanID of the event's parent in the trace tree - Source - the subsystem wrote the row. One of core, amie, comanage, slurm - Action - what the event did - EntityType - the resource where the action executed on - EntityId - UUID of the Entity eg, Root row - an `AMIE PACKET_RECEIVED` SpanID - 9b1c4f2a8d3e6f7b ParentSpanID - NULL Source - amie Action - PACKET_RECEIVED EntityType - packet EntityID - 5f7695c7-1e7c-435a-9172-73b00f650d14 Child row - a `CREATE_ACCOUNT` for the PI on that packet SpanID - 3a82d1c0e4f8b2a7 ParentSpanID - 9b1c4f2a8d3e6f7b Source - amie Action - CREATE_ACCOUNT EntityType - user EntityID - `the user UUID` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
