github.com/braveheart12/insolar-09-08-19@v0.8.7/ledger/recentstorage/metrics.go (about) 1 /* 2 * Copyright 2019 Insolar 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 recentstorage 18 19 import ( 20 "go.opencensus.io/stats" 21 "go.opencensus.io/stats/view" 22 "go.opencensus.io/tag" 23 24 "github.com/insolar/insolar/instrumentation/insmetrics" 25 ) 26 27 var ( 28 tagJet = insmetrics.MustTagKey("jet") 29 ) 30 31 var ( 32 statRecentStorageObjectsAdded = stats.Int64("storage/recent/objects/added/count", "recent storage objects added", stats.UnitDimensionless) 33 statRecentStorageObjectsRemoved = stats.Int64("storage/recent/objects/removed/count", "recent storage objects removed", stats.UnitDimensionless) 34 35 statRecentStoragePendingsAdded = stats.Int64("storage/recent/pending/added/count", "recent storage pending requests added", stats.UnitDimensionless) 36 statRecentStoragePendingsRemoved = stats.Int64("storage/recent/pending/removed/count", "recent storage pending requests removed", stats.UnitDimensionless) 37 ) 38 39 func init() { 40 commontags := []tag.Key{tagJet} 41 err := view.Register( 42 &view.View{ 43 Name: statRecentStorageObjectsAdded.Name(), 44 Description: statRecentStorageObjectsAdded.Description(), 45 Measure: statRecentStorageObjectsAdded, 46 Aggregation: view.Sum(), 47 TagKeys: commontags, 48 }, 49 &view.View{ 50 Name: statRecentStorageObjectsRemoved.Name(), 51 Description: statRecentStorageObjectsRemoved.Description(), 52 Measure: statRecentStorageObjectsRemoved, 53 Aggregation: view.Sum(), 54 TagKeys: commontags, 55 }, 56 &view.View{ 57 Name: statRecentStoragePendingsAdded.Name(), 58 Description: statRecentStoragePendingsAdded.Description(), 59 Measure: statRecentStoragePendingsAdded, 60 Aggregation: view.Sum(), 61 TagKeys: commontags, 62 }, 63 &view.View{ 64 Name: statRecentStoragePendingsRemoved.Name(), 65 Description: statRecentStoragePendingsRemoved.Description(), 66 Measure: statRecentStoragePendingsRemoved, 67 Aggregation: view.Sum(), 68 TagKeys: commontags, 69 }, 70 ) 71 if err != nil { 72 panic(err) 73 } 74 }