Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve Rest Collector #2740

Merged
merged 7 commits into from
Mar 18, 2024
Merged

feat: improve Rest Collector #2740

merged 7 commits into from
Mar 18, 2024

Conversation

rahulguptajss
Copy link
Contributor

@rahulguptajss rahulguptajss commented Mar 12, 2024

No description provided.

@cla-bot cla-bot bot added the cla-signed label Mar 12, 2024
@rahulguptajss rahulguptajss linked an issue Mar 12, 2024 that may be closed by this pull request
cmd/collectors/rest/plugins/volume/volume.go Outdated Show resolved Hide resolved
cmd/collectors/rest/rest.go Outdated Show resolved Hide resolved
cmd/collectors/restperf/restperf.go Outdated Show resolved Hide resolved
cmd/collectors/restperf/restperf.go Outdated Show resolved Hide resolved
@@ -81,6 +88,9 @@ func (b *HrefBuilder) Build() string {
if b.returnTimeout != nil {
addArg(&href, "&return_timeout=", strconv.Itoa(*b.returnTimeout))
}
if b.isIgnoreUnknownFieldsEnabled && util.IsPublicAPI(b.apiPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore_unknown_fields=true works for private CLI. Is there a good reason to disallow its use? Allowing it would make our templates a bit more version resilient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have added it for private CLI as well.

We decided not to add this, as it didn't make sense based on one of the discussions, which is also documented here.
#2164 (comment)

@rahulguptajss
Copy link
Contributor Author

Before:

### Poller: dc-1
Collector                     |TotalPollTimeMs |AvgApiMs |MaxApiMs |AvgCalcMs |AvgParseMs |AvgPluginMs |AvgInstances |AvgMetrics |Rows |AvgBytesRx |AvgNumCalls
Rest:QosWorkload              |1727            |1726     |2833     |0         |1          |0           |296          |888        |130  |127120     |1
Rest:Volume                   |6731            |3707     |4881     |0         |1773       |1251        |257          |12211      |130  |600371     |5
Rest:Sensor                   |1969            |1924     |2497     |0         |2          |43          |186          |1558       |130  |64423      |2
Rest:SecurityAccount          |6869            |3438     |6539     |0         |1          |3430        |41           |203        |388  |77747      |2
Rest:EmsDestination           |482             |481      |1016     |0         |1          |0           |87           |435        |130  |35083      |1
Rest:Qtree                    |3685            |1316     |2226     |0         |985        |1384        |44           |352        |130  |79883      |3
Rest:LIF                      |988             |671      |1704     |0         |317        |0           |39           |489        |130  |72511      |2
Rest:SVM                      |4451            |2127     |3866     |0         |1900       |424         |29           |168        |130  |141274     |13
Rest:SecurityLogin            |305             |305      |1168     |0         |0          |0           |27           |84         |130  |5437       |1
Rest:Disk                     |587             |421      |1076     |0         |166        |0           |23           |460        |130  |98452      |2
Rest:Lun                      |245             |245      |577      |0         |0          |0           |14           |112        |130  |16039      |1
Rest:NetRoute                 |184             |184      |1393     |0         |0          |0           |13           |114        |130  |10673      |1
Rest:Subsystem                |253             |253      |1130     |0         |0          |0           |13           |52         |130  |1853       |1
Rest:QosPolicyFixed           |170             |170      |705      |0         |0          |0           |12           |84         |130  |3138       |1
Rest:FCP                      |509             |509      |1285     |0         |0          |0           |8            |104        |130  |7734       |1
Rest:QosPolicyAdaptive        |150             |150      |529      |0         |0          |0           |8            |72         |130  |2917       |1
Rest:OntapS3Policy            |276             |276      |1215     |0         |0          |0           |8            |56         |130  |4691       |1
Rest:SecurityCert             |4003            |3906     |5556     |0         |0          |97          |6            |42         |130  |13223      |3
Rest:SnapMirror               |1151            |877      |1492     |0         |263        |11          |6            |116        |130  |9649       |2
Rest:OntapS3                  |1952            |1555     |2319     |0         |226        |171         |5            |58         |130  |12286      |3
Rest:NtpServer                |144             |144      |1090     |0         |0          |0           |4            |8          |130  |478        |1
Rest:VolumeAnalytics          |1566            |352      |1775     |0         |0          |1214        |4            |12         |130  |78862      |5
Rest:SnapshotPolicy           |206             |206      |1096     |0         |0          |0           |3            |12         |130  |572        |1
Rest:FlexCache                |1323            |1323     |2158     |0         |0          |0           |3            |21         |130  |3735       |1
Rest:Namespace                |244             |244      |651      |0         |0          |0           |2            |22         |130  |1922       |1
Rest:Node                     |631             |483      |882      |0         |148        |0           |2            |40         |130  |9470       |2
Rest:Aggregate                |394             |394      |1652     |0         |0          |0           |2            |103        |130  |7686       |1
Rest:CloudTarget              |157             |157      |1050     |0         |0          |0           |1            |14         |130  |786        |1
Rest:SupportAutoUpdate        |137             |137      |1361     |0         |0          |0           |1            |1          |130  |61         |1
Rest:Health                   |2877            |670      |1259     |0         |0          |2207        |1            |2          |130  |16143      |13
Rest:SecuritySsh              |191             |191      |1375     |0         |0          |0           |1            |3          |130  |601        |1
Rest:ClusterPeer              |140             |140      |1157     |0         |0          |0           |1            |3          |130  |781        |1
Rest:Support                  |142             |142      |1142     |0         |0          |0           |1            |3          |130  |176        |1
Rest:Security                 |149             |149      |1564     |0         |0          |0           |1            |3          |130  |6277       |1
Rest:Shelf                    |485             |337      |1114     |0         |148        |0           |1            |9          |130  |18322      |2
Rest:Status                   |693             |693      |1756     |0         |0          |0           |1            |1          |130  |2107       |1
Rest:SecurityAuditDestination |129             |129      |1379     |0         |0          |0           |1            |1          |130  |445        |1

After.log

### Poller: dc-1
Collector                     |TotalPollTimeMs |AvgApiMs |MaxApiMs |AvgCalcMs |AvgParseMs |AvgPluginMs |AvgInstances |AvgMetrics |Rows |AvgBytesRx |AvgNumCalls
Rest:QosWorkload              |609             |608      |1623     |0         |1          |0           |296          |888        |130  |46471      |1
Rest:Volume                   |7312            |4198     |6167     |0         |1884       |1230        |257          |12211      |130  |600371     |5
Rest:Sensor                   |2281            |2161     |7128     |0         |2          |118         |186          |1558       |130  |64423      |2
Rest:SecurityAccount          |5492            |2732     |5710     |0         |1          |2759        |41           |203        |388  |46989      |2
Rest:EmsDestination           |254             |253      |2182     |0         |1          |0           |87           |435        |130  |25885      |1
Rest:Qtree                    |4333            |1464     |4010     |0         |1134       |1735        |44           |352        |130  |60447      |3
Rest:LIF                      |1066            |755      |7484     |0         |311        |0           |39           |489        |130  |39856      |2
Rest:SVM                      |5518            |2564     |5014     |0         |2282       |672         |29           |168        |130  |37853      |13
Rest:SecurityLogin            |331             |331      |1287     |0         |0          |0           |27           |84         |130  |3981       |1
Rest:Disk                     |535             |391      |1668     |0         |144        |0           |23           |460        |130  |22959      |2
Rest:Lun                      |305             |305      |3712     |0         |0          |0           |14           |112        |130  |6383       |1
Rest:Subsystem                |335             |335      |3219     |0         |0          |0           |13           |52         |130  |1853       |1
Rest:NetRoute                 |256             |256      |3050     |0         |0          |0           |13           |114        |130  |10673      |1
Rest:QosPolicyFixed           |243             |243      |5481     |0         |0          |0           |12           |84         |130  |3138       |1
Rest:FCP                      |497             |497      |2202     |0         |0          |0           |8            |104        |130  |4661       |1
Rest:OntapS3Policy            |391             |391      |2853     |0         |0          |0           |8            |56         |130  |4691       |1
Rest:QosPolicyAdaptive        |198             |198      |1244     |0         |0          |0           |8            |72         |130  |2917       |1
Rest:SecurityCert             |4899            |4821     |6080     |0         |0          |78          |6            |42         |130  |11832      |3
Rest:SnapMirror               |1399            |1051     |2696     |0         |322        |26          |6            |116        |130  |9649       |2
Rest:OntapS3                  |2688            |1958     |4545     |0         |384        |346         |5            |58         |130  |5042       |3
Rest:NtpServer                |196             |196      |1643     |0         |0          |0           |4            |8          |130  |378        |1
Rest:VolumeAnalytics          |2061            |289      |1884     |0         |0          |1772        |4            |12         |130  |73744      |5
Rest:SnapshotPolicy           |286             |286      |5864     |0         |0          |0           |3            |12         |130  |572        |1
Rest:FlexCache                |1707            |1707     |4745     |0         |0          |0           |3            |21         |130  |3735       |1
Rest:Node                     |608             |452      |3097     |0         |156        |0           |2            |40         |130  |2243       |2
Rest:Aggregate                |468             |468      |4944     |0         |0          |0           |2            |103        |130  |7686       |1
Rest:Namespace                |274             |274      |2976     |0         |0          |0           |2            |26         |130  |1560       |1
Rest:SecurityAuditDestination |259             |259      |2202     |0         |0          |0           |1            |1          |130  |140        |1
Rest:Status                   |210             |210      |3071     |0         |0          |0           |1            |1          |130  |20         |1
Rest:SecuritySsh              |185             |185      |1206     |0         |0          |0           |1            |3          |130  |322        |1
Rest:Health                   |3394            |170      |4793     |0         |0          |3224        |1            |2          |130  |14138      |13
Rest:Support                  |169             |169      |1633     |0         |0          |0           |1            |3          |130  |68         |1
Rest:ClusterPeer              |214             |214      |1536     |0         |0          |0           |1            |3          |130  |201        |1
Rest:Shelf                    |530             |379      |5261     |0         |151        |0           |1            |9          |130  |459        |2
Rest:CloudTarget              |207             |207      |5485     |0         |0          |0           |1            |14         |130  |545        |1
Rest:SupportAutoUpdate        |179             |179      |2202     |0         |0          |0           |1            |1          |130  |22         |1
Rest:Security                 |171             |171      |3159     |0         |0          |0           |1            |3          |130  |127        |1

Difference
before - after (Negative is good)

Collector                     |TotalPollTimeMs |AvgApiMs |MaxApiMs |AvgCalcMs |AvgParseMs |AvgPluginMs |AvgInstances |AvgMetrics |Rows |AvgBytesRx |AvgNumCalls
Rest:QosWorkload              |-1118           |-1118    |1210     |0         |0          |0           |0            |0          |0    |-80649     |0
Rest:Volume                   |581             |491      |-1286    |0         |111        |-21         |0            |0          |0    |0          |0
Rest:Sensor                   |312             |237      |-4631    |0         |0          |75          |0            |0          |0    |0          |0
Rest:SecurityAccount          |-1377           |-706     |829      |0         |0          |-671        |0            |0          |0    |-30758     |0
Rest:EmsDestination           |-228            |-228     |-1166    |0         |0          |0           |0            |0          |0    |-9198      |0
Rest:Qtree                    |648             |148      |-1784    |0         |149        |351         |0            |0          |0    |-19436     |0
Rest:LIF                      |78              |84       |-5780    |0         |-6         |0           |0            |0          |0    |-32655     |0
Rest:SVM                      |1067            |437      |-1148    |0         |382        |248         |0            |0          |0    |-103421    |0
Rest:SecurityLogin            |26              |26       |-119     |0         |0          |0           |0            |0          |0    |-1456      |0
Rest:Disk                     |-52             |-30      |-592     |0         |-22        |0           |0            |0          |0    |-75493     |0
Rest:Lun                      |60              |60       |-3135    |0         |0          |0           |0            |0          |0    |-9656      |0
Rest:NetRoute                 |72              |72       |-1657    |0         |0          |0           |0            |0          |0    |0          |0
Rest:Subsystem                |82              |82       |-2089    |0         |0          |0           |0            |0          |0    |0          |0
Rest:QosPolicyFixed           |73              |73       |-4776    |0         |0          |0           |0            |0          |0    |0          |0
Rest:FCP                      |-12             |-12      |-917     |0         |0          |0           |0            |0          |0    |-3073      |0
Rest:QosPolicyAdaptive        |48              |48       |-715     |0         |0          |0           |0            |0          |0    |0          |0
Rest:OntapS3Policy            |115             |115      |-1638    |0         |0          |0           |0            |0          |0    |0          |0
Rest:SecurityCert             |896             |915      |-524     |0         |0          |-19         |0            |0          |0    |-1391      |0
Rest:SnapMirror               |248             |174      |-1204    |0         |59         |15          |0            |0          |0    |0          |0
Rest:OntapS3                  |736             |403      |-2226    |0         |158        |175         |0            |0          |0    |-7244      |0
Rest:NtpServer                |52              |52       |-553     |0         |0          |0           |0            |0          |0    |-100       |0
Rest:VolumeAnalytics          |495             |-63      |-109     |0         |0          |558         |0            |0          |0    |-5118      |0
Rest:SnapshotPolicy           |80              |80       |-4768    |0         |0          |0           |0            |0          |0    |0          |0
Rest:FlexCache                |384             |384      |-2587    |0         |0          |0           |0            |0          |0    |0          |0
Rest:Namespace                |30              |30       |-2325    |0         |0          |0           |0            |4          |0    |-362       |0
Rest:Node                     |-23             |-31      |-2215    |0         |8          |0           |0            |0          |0    |-7227      |0
Rest:Aggregate                |74              |74       |-3292    |0         |0          |0           |0            |0          |0    |0          |0
Rest:CloudTarget              |50              |50       |-4435    |0         |0          |0           |0            |0          |0    |-241       |0
Rest:SupportAutoUpdate        |42              |42       |-841     |0         |0          |0           |0            |0          |0    |-39        |0
Rest:Health                   |517             |-500     |-3534    |0         |0          |1017        |0            |0          |0    |-2005      |0
Rest:SecuritySsh              |-6              |-6       |169      |0         |0          |0           |0            |0          |0    |-279       |0
Rest:ClusterPeer              |74              |74       |-379     |0         |0          |0           |0            |0          |0    |-580       |0
Rest:Support                  |27              |27       |-491     |0         |0          |0           |0            |0          |0    |-108       |0
Rest:Security                 |22              |22       |-1595    |0         |0          |0           |0            |0          |0    |-6150      |0
Rest:Shelf                    |45              |42       |-4147    |0         |3          |0           |0            |0          |0    |-17863     |0
Rest:Status                   |-483            |-483     |-1315    |0         |0          |0           |0            |0          |0    |-2087      |0
Rest:SecurityAuditDestination |130             |130      |-823     |0         |0          |0           |0            |0          |0    |-305       |0

Percentage Change
100* ((Before - After) / Before). Negative is good

Collector                     |TotalPollTimeMs |AvgApiMs |MaxApiMs |AvgCalcMs |AvgParseMs |AvgPluginMs |AvgInstances |AvgMetrics |Rows |AvgBytesRx |AvgNumCalls
Rest:QosWorkload              |-64.74          |-64.77   |42.71    |NaN       |0.00       |NaN         |0.00         |0.00       |0.00 |-63.44     |0.00
Rest:Volume                   |8.63            |13.25    |-26.35   |NaN       |6.26       |-1.68       |0.00         |0.00       |0.00 |0.00       |0.00
Rest:Sensor                   |15.85           |12.32    |-185.46  |NaN       |0.00       |174.42      |0.00         |0.00       |0.00 |0.00       |0.00
Rest:SecurityAccount          |-20.05          |-20.54   |12.68    |NaN       |0.00       |-19.56      |0.00         |0.00       |0.00 |-39.56     |0.00
Rest:EmsDestination           |-47.30          |-47.40   |-114.76  |NaN       |0.00       |NaN         |0.00         |0.00       |0.00 |-26.22     |0.00
Rest:Qtree                    |17.58           |11.25    |-80.14   |NaN       |15.13      |25.36       |0.00         |0.00       |0.00 |-24.33     |0.00
Rest:LIF                      |7.89            |12.52    |-339.20  |NaN       |-1.89      |NaN         |0.00         |0.00       |0.00 |-45.03     |0.00
Rest:SVM                      |23.97           |20.55    |-29.69   |NaN       |20.11      |58.49       |0.00         |0.00       |0.00 |-73.21     |0.00
Rest:SecurityLogin            |8.52            |8.52     |-10.19   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-26.78     |0.00
Rest:Disk                     |-8.86           |-7.13    |-55.02   |NaN       |-13.25     |NaN         |0.00         |0.00       |0.00 |-76.68     |0.00
Rest:Lun                      |24.49           |24.49    |-543.33  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-60.20     |0.00
Rest:NetRoute                 |39.13           |39.13    |-118.95  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:Subsystem                |32.41           |32.41    |-184.87  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:QosPolicyFixed           |42.94           |42.94    |-677.45  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:FCP                      |-2.36           |-2.36    |-71.36   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-39.73     |0.00
Rest:QosPolicyAdaptive        |32.00           |32.00    |-135.16  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:OntapS3Policy            |41.67           |41.67    |-134.81  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:SecurityCert             |22.38           |23.43    |-9.43    |NaN       |NaN        |-19.59      |0.00         |0.00       |0.00 |-10.52     |0.00
Rest:SnapMirror               |21.55           |19.84    |-80.70   |NaN       |22.43      |136.36      |0.00         |0.00       |0.00 |0.00       |0.00
Rest:OntapS3                  |37.70           |25.92    |-95.99   |NaN       |69.91      |102.34      |0.00         |0.00       |0.00 |-58.96     |0.00
Rest:NtpServer                |36.11           |36.11    |-50.73   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-20.92     |0.00
Rest:VolumeAnalytics          |31.61           |-17.90   |-6.14    |NaN       |NaN        |45.96       |0.00         |0.00       |0.00 |-6.49      |0.00
Rest:SnapshotPolicy           |38.83           |38.83    |-435.04  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:FlexCache                |29.02           |29.02    |-119.88  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:Namespace                |12.30           |12.30    |-357.14  |NaN       |NaN        |NaN         |0.00         |18.18      |0.00 |-18.83     |0.00
Rest:Node                     |-3.65           |-6.42    |-251.13  |NaN       |5.41       |NaN         |0.00         |0.00       |0.00 |-76.31     |0.00
Rest:Aggregate                |18.78           |18.78    |-199.27  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |0.00       |0.00
Rest:CloudTarget              |31.85           |31.85    |-422.38  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-30.66     |0.00
Rest:SupportAutoUpdate        |30.66           |30.66    |-61.79   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-63.93     |0.00
Rest:Health                   |17.97           |-74.63   |-280.70  |NaN       |NaN        |46.08       |0.00         |0.00       |0.00 |-12.42     |0.00
Rest:SecuritySsh              |-3.14           |-3.14    |12.29    |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-46.42     |0.00
Rest:ClusterPeer              |52.86           |52.86    |-32.76   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-74.26     |0.00
Rest:Support                  |19.01           |19.01    |-42.99   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-61.36     |0.00
Rest:Security                 |14.77           |14.77    |-101.98  |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-97.98     |0.00
Rest:Shelf                    |9.28            |12.46    |-372.26  |NaN       |2.03       |NaN         |0.00         |0.00       |0.00 |-97.49     |0.00
Rest:Status                   |-69.70          |-69.70   |-74.89   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-99.05     |0.00
Rest:SecurityAuditDestination |100.78          |100.78   |-59.68   |NaN       |NaN        |NaN         |0.00         |0.00       |0.00 |-68.54     |0.00

Alloc: Alloc improvements are in range of ~6-8%

Analysis.zip

@cgrinds
Copy link
Collaborator

cgrinds commented Mar 15, 2024

This PR reduces bytesRx by ~27% when monitoring the sar cluster

cgrinds
cgrinds previously approved these changes Mar 15, 2024
Comment on lines +391 to +394
if err != nil {
return nil, err
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed as err just hasn't been used.

@@ -677,7 +677,7 @@ func (r *RestPerf) PollData() (map[string]*matrix.Matrix, error) {

href := rest.NewHrefBuilder().
APIPath(dataQuery).
Fields(r.Prop.Fields).
Fields([]string{"*"}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for restperf, we will always send *?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It will change as part of next story.

@rahulguptajss rahulguptajss merged commit 5260883 into main Mar 18, 2024
10 checks passed
@rahulguptajss rahulguptajss deleted the rg2-2164 branch March 18, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate improving Harvest REST collector
3 participants