DImuthuUpe commented on code in PR #489: URL: https://github.com/apache/airavata-custos/pull/489#discussion_r3369706770
########## 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 { Review Comment: What is the relationship between TraceSummary and TraceEvent.Summary ########## 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: @lahirujayathilake can you explain what SpanID, ParentSpanID, Source, Action, EntityType and EntityID represent? An example would be really helpful ########## 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), + }) +} + +type TraceEvent struct { + SpanID []byte `db:"span_id" json:"-"` + ParentSpanID []byte `db:"parent_span_id" json:"-"` + Source string `db:"source" json:"source"` + Action string `db:"action" json:"action"` + EntityType string `db:"entity_type" json:"entity_type,omitempty"` + EntityID string `db:"entity_id" json:"entity_id,omitempty"` + Summary string `db:"summary" json:"summary,omitempty"` + Status string `db:"status" json:"status"` Review Comment: What is the releationship between the Summary and Status? ########## 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"` Review Comment: What is an example for the RootOperation? -- 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]
