Skip to content

Commit ba39249

Browse files
atoulmegithub-actions[bot]
authored andcommitted
[receiver/splunkenterprise]unexport Info struct (open-telemetry#40267)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This struct should not be exposed as part of the API. Unexporting it. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent d8c37cf commit ba39249

File tree

3 files changed

+50
-23
lines changed

3 files changed

+50
-23
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: splunkenterprisereceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Unexport Info
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40267]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

receiver/splunkenterprisereceiver/scraper.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ func (s *splunkScraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
115115
}()
116116

117117
// if the build and version info has been configured that is pulled here
118-
var info infoDict
118+
var infoMap infoDict
119119
if s.conf.VersionInfo {
120-
info = s.scrapeInfo(ctx, now, errChan)
120+
infoMap = s.scrapeInfo(ctx, now, errChan)
121121
} 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
127127
}
128128

129129
for _, fn := range metricScrapes {
@@ -138,7 +138,7 @@ func (s *splunkScraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
138138
// actual function body
139139
defer wg.Done()
140140
fn(ctx, now, info, errs)
141-
}(fn, ctx, now, info, errChan)
141+
}(fn, ctx, now, infoMap, errChan)
142142
}
143143

144144
wg.Wait()
@@ -1810,49 +1810,49 @@ func (s *splunkScraper) traverseHealthDetailFeatures(details healthDetails, now
18101810
}
18111811

18121812
// 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 {
18141814
// there could be an endpoint configured for each type (never more than 3)
18151815

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
18211821

18221822
for cliType := range s.splunkClient.clients {
1823-
var i Info
1823+
var i info
18241824

18251825
ept := apiDict[`SplunkInfo`]
18261826

18271827
req, err := s.splunkClient.createAPIRequest(cliType, ept)
18281828
if err != nil {
18291829
errs <- err
1830-
return info
1830+
return infoMap
18311831
}
18321832

18331833
res, err := s.splunkClient.makeRequest(req)
18341834
if err != nil {
18351835
errs <- err
1836-
return info
1836+
return infoMap
18371837
}
18381838
defer res.Body.Close()
18391839

18401840
body, err := io.ReadAll(res.Body)
18411841
if err != nil {
18421842
errs <- err
1843-
return info
1843+
return infoMap
18441844
}
18451845

18461846
err = json.Unmarshal(body, &i)
18471847
if err != nil {
18481848
errs <- err
1849-
return info
1849+
return infoMap
18501850
}
18511851

1852-
info[cliType] = i
1852+
infoMap[cliType] = i
18531853
}
18541854

1855-
return info
1855+
return infoMap
18561856
}
18571857

18581858
// Scrape Search Metrics

receiver/splunkenterprisereceiver/search_result.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ type healthDetails struct {
195195
}
196196

197197
// '/services/server/info'
198-
type Info struct {
198+
type info struct {
199199
Host string `json:"origin"`
200200
Entries []infoEntry `json:"entry"`
201201
}
@@ -209,7 +209,7 @@ type infoContent struct {
209209
Version string `json:"version"`
210210
}
211211

212-
type infoDict map[any]Info
212+
type infoDict map[any]info
213213

214214
// '/services/search/jobs/{search_id}'
215215
type searchMetaEntries struct {

0 commit comments

Comments
 (0)