@@ -34,7 +34,7 @@ const (
3434 peerStateUnhealthy = "unhealthy"
3535)
3636
37- type NginxPlusScraper struct {
37+ type nginxPlusScraper struct {
3838 previousServerZoneResponses map [string ]ResponseStatuses
3939 previousLocationZoneResponses map [string ]ResponseStatuses
4040 plusClient * plusapi.NginxClient
@@ -57,7 +57,7 @@ type ResponseStatuses struct {
5757func newNginxPlusScraper (
5858 settings receiver.Settings ,
5959 cfg * Config ,
60- ) (* NginxPlusScraper , error ) {
60+ ) (* nginxPlusScraper , error ) {
6161 endpoint := strings .TrimPrefix (cfg .APIDetails .URL , "unix:" )
6262 logger := settings .Logger
6363 logger .Info ("Creating NGINX Plus scraper" )
@@ -79,7 +79,7 @@ func newNginxPlusScraper(
7979 return nil , err
8080 }
8181
82- return & NginxPlusScraper {
82+ return & nginxPlusScraper {
8383 plusClient : plusClient ,
8484 settings : settings ,
8585 cfg : cfg ,
@@ -89,7 +89,7 @@ func newNginxPlusScraper(
8989 }, nil
9090}
9191
92- func (nps * NginxPlusScraper ) createPreviousLocationZoneResponses (stats * plusapi.Stats ) {
92+ func (nps * nginxPlusScraper ) createPreviousLocationZoneResponses (stats * plusapi.Stats ) {
9393 previousLocationZoneResponses := make (map [string ]ResponseStatuses )
9494 for lzName , lz := range stats .LocationZones {
9595 respStatus := ResponseStatuses {
@@ -106,7 +106,7 @@ func (nps *NginxPlusScraper) createPreviousLocationZoneResponses(stats *plusapi.
106106 nps .previousLocationZoneResponses = previousLocationZoneResponses
107107}
108108
109- func (nps * NginxPlusScraper ) createPreviousServerZoneResponses (stats * plusapi.Stats ) {
109+ func (nps * nginxPlusScraper ) createPreviousServerZoneResponses (stats * plusapi.Stats ) {
110110 previousServerZoneResponses := make (map [string ]ResponseStatuses )
111111 for szName , sz := range stats .ServerZones {
112112 respStatus := ResponseStatuses {
@@ -123,7 +123,7 @@ func (nps *NginxPlusScraper) createPreviousServerZoneResponses(stats *plusapi.St
123123 nps .previousServerZoneResponses = previousServerZoneResponses
124124}
125125
126- func (nps * NginxPlusScraper ) scrape (ctx context.Context ) (pmetric.Metrics , error ) {
126+ func (nps * nginxPlusScraper ) scrape (ctx context.Context ) (pmetric.Metrics , error ) {
127127 // nps.init.Do is ran only once, it is only ran the first time scrape is called to set the previous responses
128128 // metric value
129129 nps .init .Do (func () {
@@ -151,7 +151,7 @@ func (nps *NginxPlusScraper) scrape(ctx context.Context) (pmetric.Metrics, error
151151 return nps .mb .Emit (metadata .WithResource (nps .rb .Emit ())), nil
152152}
153153
154- func (nps * NginxPlusScraper ) recordMetrics (stats * plusapi.Stats ) {
154+ func (nps * nginxPlusScraper ) recordMetrics (stats * plusapi.Stats ) {
155155 now := pcommon .NewTimestampFromTime (time .Now ())
156156
157157 // NGINX config reloads
@@ -193,7 +193,7 @@ func (nps *NginxPlusScraper) recordMetrics(stats *plusapi.Stats) {
193193 nps .recordStreamMetrics (stats , now )
194194}
195195
196- func (nps * NginxPlusScraper ) recordStreamMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
196+ func (nps * nginxPlusScraper ) recordStreamMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
197197 for name , streamServerZone := range stats .StreamServerZones {
198198 nps .mb .RecordNginxStreamIoDataPoint (
199199 now ,
@@ -437,7 +437,7 @@ func (nps *NginxPlusScraper) recordStreamMetrics(stats *plusapi.Stats, now pcomm
437437 }
438438}
439439
440- func (nps * NginxPlusScraper ) recordSSLMetrics (now pcommon.Timestamp , stats * plusapi.Stats ) {
440+ func (nps * nginxPlusScraper ) recordSSLMetrics (now pcommon.Timestamp , stats * plusapi.Stats ) {
441441 nps .mb .RecordNginxSslHandshakesDataPoint (
442442 now ,
443443 int64 (stats .SSL .HandshakesFailed ),
@@ -503,7 +503,7 @@ func (nps *NginxPlusScraper) recordSSLMetrics(now pcommon.Timestamp, stats *plus
503503 )
504504}
505505
506- func (nps * NginxPlusScraper ) recordSlabPageMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
506+ func (nps * nginxPlusScraper ) recordSlabPageMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
507507 for name , slab := range stats .Slabs {
508508 nps .mb .RecordNginxSlabPageFreeDataPoint (now , int64 (slab .Pages .Free ), name )
509509 nps .mb .RecordNginxSlabPageUsageDataPoint (now , int64 (slab .Pages .Used ), name )
@@ -534,7 +534,7 @@ func (nps *NginxPlusScraper) recordSlabPageMetrics(stats *plusapi.Stats, now pco
534534 }
535535}
536536
537- func (nps * NginxPlusScraper ) recordHTTPUpstreamPeerMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
537+ func (nps * nginxPlusScraper ) recordHTTPUpstreamPeerMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
538538 for name , upstream := range stats .Upstreams {
539539 nps .mb .RecordNginxHTTPUpstreamKeepaliveCountDataPoint (now , int64 (upstream .Keepalive ), upstream .Zone , name )
540540
@@ -803,7 +803,7 @@ func (nps *NginxPlusScraper) recordHTTPUpstreamPeerMetrics(stats *plusapi.Stats,
803803 }
804804}
805805
806- func (nps * NginxPlusScraper ) recordServerZoneMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
806+ func (nps * nginxPlusScraper ) recordServerZoneMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
807807 for szName , sz := range stats .ServerZones {
808808 nps .mb .RecordNginxHTTPRequestIoDataPoint (
809809 now ,
@@ -838,7 +838,7 @@ func (nps *NginxPlusScraper) recordServerZoneMetrics(stats *plusapi.Stats, now p
838838
839839// Duplicate of recordLocationZoneHTTPMetrics but same function can not be used due to plusapi.ServerZone
840840// nolint: dupl
841- func (nps * NginxPlusScraper ) recordServerZoneHTTPMetrics (sz plusapi.ServerZone , szName string , now pcommon.Timestamp ) {
841+ func (nps * nginxPlusScraper ) recordServerZoneHTTPMetrics (sz plusapi.ServerZone , szName string , now pcommon.Timestamp ) {
842842 nps .mb .RecordNginxHTTPResponseStatusDataPoint (now , int64 (sz .Responses .Responses1xx ),
843843 metadata .AttributeNginxStatusRange1xx ,
844844 szName ,
@@ -908,7 +908,7 @@ func (nps *NginxPlusScraper) recordServerZoneHTTPMetrics(sz plusapi.ServerZone,
908908 nps .previousServerZoneResponses [szName ] = respStatus
909909}
910910
911- func (nps * NginxPlusScraper ) recordLocationZoneMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
911+ func (nps * nginxPlusScraper ) recordLocationZoneMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
912912 for lzName , lz := range stats .LocationZones {
913913 nps .mb .RecordNginxHTTPRequestIoDataPoint (
914914 now ,
@@ -943,7 +943,7 @@ func (nps *NginxPlusScraper) recordLocationZoneMetrics(stats *plusapi.Stats, now
943943
944944// Duplicate of recordServerZoneHTTPMetrics but same function can not be used due to plusapi.LocationZone
945945// nolint: dupl
946- func (nps * NginxPlusScraper ) recordLocationZoneHTTPMetrics (lz plusapi.LocationZone ,
946+ func (nps * nginxPlusScraper ) recordLocationZoneHTTPMetrics (lz plusapi.LocationZone ,
947947 lzName string , now pcommon.Timestamp ,
948948) {
949949 nps .mb .RecordNginxHTTPResponseStatusDataPoint (now , int64 (lz .Responses .Responses1xx ),
@@ -1015,7 +1015,7 @@ func (nps *NginxPlusScraper) recordLocationZoneHTTPMetrics(lz plusapi.LocationZo
10151015 nps .previousLocationZoneResponses [lzName ] = respStatus
10161016}
10171017
1018- func (nps * NginxPlusScraper ) recordHTTPLimitMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
1018+ func (nps * nginxPlusScraper ) recordHTTPLimitMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
10191019 for name , limitConnection := range stats .HTTPLimitConnections {
10201020 nps .mb .RecordNginxHTTPLimitConnRequestsDataPoint (
10211021 now ,
@@ -1071,7 +1071,7 @@ func (nps *NginxPlusScraper) recordHTTPLimitMetrics(stats *plusapi.Stats, now pc
10711071 }
10721072}
10731073
1074- func (nps * NginxPlusScraper ) recordCacheMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
1074+ func (nps * nginxPlusScraper ) recordCacheMetrics (stats * plusapi.Stats , now pcommon.Timestamp ) {
10751075 for name , cache := range stats .Caches {
10761076 nps .mb .RecordNginxCacheBytesReadDataPoint (
10771077 now ,
@@ -1174,7 +1174,7 @@ func socketClient(socketPath string) *http.Client {
11741174 }
11751175}
11761176
1177- func (nps * NginxPlusScraper ) Shutdown (ctx context.Context ) error {
1177+ func (nps * nginxPlusScraper ) Shutdown (ctx context.Context ) error {
11781178 return nil
11791179}
11801180
0 commit comments