vitess.io/vitess@v0.16.2/go/vt/vtorc/discovery/metric.go (about) 1 /* 2 Copyright 2017 Simon J Mudd 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package discovery 18 19 // Collect discovery metrics and manage their storage and retrieval for monitoring purposes. 20 21 import ( 22 "time" 23 24 "vitess.io/vitess/go/vt/vtorc/inst" 25 ) 26 27 // Metric holds a set of information of instance discovery metrics 28 type Metric struct { 29 Timestamp time.Time // time the collection was taken 30 InstanceKey inst.InstanceKey // instance being monitored 31 BackendLatency time.Duration // time taken talking to the backend 32 InstanceLatency time.Duration // time taken talking to the instance 33 TotalLatency time.Duration // total time taken doing the discovery 34 Err error // error (if applicable) doing the discovery process 35 } 36 37 // When did the metric happen 38 func (m Metric) When() time.Time { 39 return m.Timestamp 40 }