@@ -115,15 +115,15 @@ func (s *splunkScraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
115
115
}()
116
116
117
117
// if the build and version info has been configured that is pulled here
118
- var info infoDict
118
+ var infoMap infoDict
119
119
if s .conf .VersionInfo {
120
- info = s .scrapeInfo (ctx , now , errChan )
120
+ infoMap = s .scrapeInfo (ctx , now , errChan )
121
121
} else {
122
- info = make (infoDict )
123
- nullInfo := Info {Host : "" , Entries : make ([]infoEntry , 1 )}
124
- info [typeCm ] = nullInfo
125
- info [typeSh ] = nullInfo
126
- info [typeIdx ] = nullInfo
122
+ infoMap = make (infoDict )
123
+ nullInfo := info {Host : "" , Entries : make ([]infoEntry , 1 )}
124
+ infoMap [typeCm ] = nullInfo
125
+ infoMap [typeSh ] = nullInfo
126
+ infoMap [typeIdx ] = nullInfo
127
127
}
128
128
129
129
for _ , fn := range metricScrapes {
@@ -138,7 +138,7 @@ func (s *splunkScraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
138
138
// actual function body
139
139
defer wg .Done ()
140
140
fn (ctx , now , info , errs )
141
- }(fn , ctx , now , info , errChan )
141
+ }(fn , ctx , now , infoMap , errChan )
142
142
}
143
143
144
144
wg .Wait ()
@@ -1810,49 +1810,49 @@ func (s *splunkScraper) traverseHealthDetailFeatures(details healthDetails, now
1810
1810
}
1811
1811
1812
1812
// somewhat unique scrape function for gathering the info attribute
1813
- func (s * splunkScraper ) scrapeInfo (_ context.Context , _ pcommon.Timestamp , errs chan error ) map [any ]Info {
1813
+ func (s * splunkScraper ) scrapeInfo (_ context.Context , _ pcommon.Timestamp , errs chan error ) map [any ]info {
1814
1814
// there could be an endpoint configured for each type (never more than 3)
1815
1815
1816
- info := make (infoDict )
1817
- nullInfo := Info {Host : "" , Entries : make ([]infoEntry , 1 )}
1818
- info [typeCm ] = nullInfo
1819
- info [typeSh ] = nullInfo
1820
- info [typeIdx ] = nullInfo
1816
+ infoMap := make (infoDict )
1817
+ nullInfo := info {Host : "" , Entries : make ([]infoEntry , 1 )}
1818
+ infoMap [typeCm ] = nullInfo
1819
+ infoMap [typeSh ] = nullInfo
1820
+ infoMap [typeIdx ] = nullInfo
1821
1821
1822
1822
for cliType := range s .splunkClient .clients {
1823
- var i Info
1823
+ var i info
1824
1824
1825
1825
ept := apiDict [`SplunkInfo` ]
1826
1826
1827
1827
req , err := s .splunkClient .createAPIRequest (cliType , ept )
1828
1828
if err != nil {
1829
1829
errs <- err
1830
- return info
1830
+ return infoMap
1831
1831
}
1832
1832
1833
1833
res , err := s .splunkClient .makeRequest (req )
1834
1834
if err != nil {
1835
1835
errs <- err
1836
- return info
1836
+ return infoMap
1837
1837
}
1838
1838
defer res .Body .Close ()
1839
1839
1840
1840
body , err := io .ReadAll (res .Body )
1841
1841
if err != nil {
1842
1842
errs <- err
1843
- return info
1843
+ return infoMap
1844
1844
}
1845
1845
1846
1846
err = json .Unmarshal (body , & i )
1847
1847
if err != nil {
1848
1848
errs <- err
1849
- return info
1849
+ return infoMap
1850
1850
}
1851
1851
1852
- info [cliType ] = i
1852
+ infoMap [cliType ] = i
1853
1853
}
1854
1854
1855
- return info
1855
+ return infoMap
1856
1856
}
1857
1857
1858
1858
// Scrape Search Metrics
0 commit comments