| 2181 | } |
| 2182 | |
| 2183 | func (d *DbStats) DBReplicatorStats(replicationID string) (*DbReplicatorStats, error) { |
| 2184 | d.dbReplicatorStatsMutex.Lock() |
| 2185 | defer d.dbReplicatorStatsMutex.Unlock() |
| 2186 | |
| 2187 | if _, ok := d.DbReplicatorStats[replicationID]; ok { |
| 2188 | return d.DbReplicatorStats[replicationID], nil |
| 2189 | } |
| 2190 | var err error |
| 2191 | resUtil := &DbReplicatorStats{} |
| 2192 | labelKeys := []string{DatabaseLabelKey, ReplicationLabelKey} |
| 2193 | labelVals := []string{d.dbName, replicationID} |
| 2194 | |
| 2195 | resUtil.NumAttachmentBytesPushed, err = NewIntStat(SubsystemReplication, "sgr_num_attachment_bytes_pushed", StatUnitBytes, SGRNumAttachmentBytesPushedDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2196 | if err != nil { |
| 2197 | return nil, err |
| 2198 | } |
| 2199 | resUtil.NumAttachmentPushed, err = NewIntStat(SubsystemReplication, "sgr_num_attachments_pushed", StatUnitNoUnits, SGRNumAttachmentsPushedDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2200 | if err != nil { |
| 2201 | return nil, err |
| 2202 | } |
| 2203 | resUtil.NumDocPushed, err = NewIntStat(SubsystemReplication, "sgr_num_docs_pushed", StatUnitNoUnits, SGRNumDocsPushedDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2204 | if err != nil { |
| 2205 | return nil, err |
| 2206 | } |
| 2207 | resUtil.NumDocsFailedToPush, err = NewIntStat(SubsystemReplication, "sgr_num_docs_failed_to_push", StatUnitNoUnits, SGRNumDocsFailedToPushDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2208 | if err != nil { |
| 2209 | return nil, err |
| 2210 | } |
| 2211 | resUtil.PushConflictCount, err = NewIntStat(SubsystemReplication, "sgr_push_conflict_count", StatUnitNoUnits, SGRPushConflictCountDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2212 | if err != nil { |
| 2213 | return nil, err |
| 2214 | } |
| 2215 | resUtil.PushRejectedCount, err = NewIntStat(SubsystemReplication, "sgr_push_rejected_count", StatUnitNoUnits, SGRPushRejectedCountDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2216 | if err != nil { |
| 2217 | return nil, err |
| 2218 | } |
| 2219 | resUtil.PushDeltaSentCount, err = NewIntStat(SubsystemReplication, "sgr_deltas_sent", StatUnitNoUnits, SGRDeltasSentDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2220 | if err != nil { |
| 2221 | return nil, err |
| 2222 | } |
| 2223 | resUtil.DocsCheckedSent, err = NewIntStat(SubsystemReplication, "sgr_docs_checked_sent", StatUnitNoUnits, SGRDocsCheckedSentDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2224 | if err != nil { |
| 2225 | return nil, err |
| 2226 | } |
| 2227 | resUtil.NumConnectAttemptsPush, err = NewIntStat(SubsystemReplication, "sgr_num_connect_attempts_push", StatUnitNoUnits, SGRNumConnectAttemptsPushDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2228 | if err != nil { |
| 2229 | return nil, err |
| 2230 | } |
| 2231 | resUtil.NumReconnectsAbortedPush, err = NewIntStat(SubsystemReplication, "sgr_num_reconnects_aborted_push", StatUnitNoUnits, SGRNumReconnectsAbortedPushDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2232 | if err != nil { |
| 2233 | return nil, err |
| 2234 | } |
| 2235 | resUtil.NumAttachmentBytesPulled, err = NewIntStat(SubsystemReplication, "sgr_num_attachment_bytes_pulled", StatUnitBytes, SGRNumAttachmentBytesPulledDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2236 | if err != nil { |
| 2237 | return nil, err |
| 2238 | } |
| 2239 | resUtil.NumAttachmentsPulled, err = NewIntStat(SubsystemReplication, "sgr_num_attachments_pulled", StatUnitNoUnits, SGRNumAttachmentsPulledDesc, StatAddedVersion3dot0dot0, StatDeprecatedVersionNotDeprecated, StatStabilityCommitted, labelKeys, labelVals, prometheus.CounterValue, 0) |
| 2240 | if err != nil { |