Skip to content

Commit 4a154e3

Browse files
add changelog
1 parent 04d48c4 commit 4a154e3

File tree

4 files changed

+29
-180
lines changed

4 files changed

+29
-180
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: 'enhancement'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: 'signalfxexporter'
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: 'Prioritize token in context when accesstokenpassthrough is enabled'
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: [37102]
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: []

exporter/signalfxexporter/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (cfg *Config) Unmarshal(componentParser *confmap.Conf) error {
215215

216216
// Validate checks if the exporter configuration is valid.
217217
func (cfg *Config) Validate() error {
218-
if cfg.AccessToken == "" && !cfg.AccessTokenPassthrough {
218+
if cfg.AccessToken == "" {
219219
return errors.New(`requires a non-empty "access_token"`)
220220
}
221221

exporter/signalfxexporter/config_test.go

Lines changed: 0 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -284,182 +284,6 @@ func TestLoadConfig(t *testing.T) {
284284
SendOTLPHistograms: true,
285285
},
286286
},
287-
{
288-
id: component.NewIDWithName(metadata.Type, ""),
289-
expected: &Config{
290-
AccessToken: "",
291-
Realm: "ap0",
292-
ClientConfig: confighttp.ClientConfig{
293-
Timeout: 10 * time.Second,
294-
Headers: map[string]configopaque.String{},
295-
MaxIdleConns: &hundred,
296-
MaxIdleConnsPerHost: &hundred,
297-
MaxConnsPerHost: &defaultMaxConnsPerHost,
298-
IdleConnTimeout: &idleConnTimeout,
299-
HTTP2ReadIdleTimeout: 10 * time.Second,
300-
HTTP2PingTimeout: 10 * time.Second,
301-
},
302-
BackOffConfig: configretry.BackOffConfig{
303-
Enabled: true,
304-
InitialInterval: 5 * time.Second,
305-
MaxInterval: 30 * time.Second,
306-
MaxElapsedTime: 5 * time.Minute,
307-
RandomizationFactor: backoff.DefaultRandomizationFactor,
308-
Multiplier: backoff.DefaultMultiplier,
309-
},
310-
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
311-
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{
312-
AccessTokenPassthrough: true,
313-
},
314-
LogDimensionUpdates: false,
315-
DimensionClient: DimensionClientConfig{
316-
MaxBuffered: 10000,
317-
SendDelay: 10 * time.Second,
318-
MaxIdleConns: 20,
319-
MaxIdleConnsPerHost: 20,
320-
MaxConnsPerHost: 20,
321-
IdleConnTimeout: 30 * time.Second,
322-
Timeout: 10 * time.Second,
323-
},
324-
TranslationRules: nil,
325-
ExcludeMetrics: nil,
326-
IncludeMetrics: nil,
327-
DeltaTranslationTTL: 3600,
328-
ExcludeProperties: nil,
329-
Correlation: &correlation.Config{
330-
ClientConfig: confighttp.ClientConfig{
331-
Endpoint: "",
332-
Timeout: 5 * time.Second,
333-
Headers: map[string]configopaque.String{},
334-
MaxIdleConns: &defaultMaxIdleConns,
335-
MaxIdleConnsPerHost: &defaultMaxIdleConnsPerHost,
336-
MaxConnsPerHost: &defaultMaxConnsPerHost,
337-
IdleConnTimeout: &defaultIdleConnTimeout,
338-
},
339-
StaleServiceTimeout: 5 * time.Minute,
340-
SyncAttributes: map[string]string{
341-
"k8s.pod.uid": "k8s.pod.uid",
342-
"container.id": "container.id",
343-
},
344-
Config: apmcorrelation.Config{
345-
MaxRequests: 20,
346-
MaxBuffered: 10_000,
347-
MaxRetries: 2,
348-
LogUpdates: false,
349-
RetryDelay: 30 * time.Second,
350-
CleanupInterval: 1 * time.Minute,
351-
},
352-
},
353-
NonAlphanumericDimensionChars: "_-.",
354-
SendOTLPHistograms: false,
355-
},
356-
},
357-
}
358-
359-
for _, tt := range tests {
360-
t.Run(tt.id.String(), func(t *testing.T) {
361-
factory := NewFactory()
362-
cfg := factory.CreateDefaultConfig()
363-
364-
sub, err := cm.Sub(tt.id.String())
365-
require.NoError(t, err)
366-
require.NoError(t, sub.Unmarshal(cfg))
367-
368-
assert.NoError(t, component.ValidateConfig(cfg))
369-
// We need to add the default exclude rules.
370-
assert.NoError(t, setDefaultExcludes(tt.expected))
371-
assert.Equal(t, tt.expected, cfg)
372-
})
373-
}
374-
}
375-
376-
func TestEmptyAccessTokenPassValidate(t *testing.T) {
377-
t.Parallel()
378-
379-
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
380-
require.NoError(t, err)
381-
382-
hundred := 100
383-
idleConnTimeout := 30 * time.Second
384-
defaultMaxIdleConns := http.DefaultTransport.(*http.Transport).MaxIdleConns
385-
defaultMaxIdleConnsPerHost := http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost
386-
defaultMaxConnsPerHost := http.DefaultTransport.(*http.Transport).MaxConnsPerHost
387-
defaultIdleConnTimeout := http.DefaultTransport.(*http.Transport).IdleConnTimeout
388-
389-
tests := []struct {
390-
id component.ID
391-
expected *Config
392-
}{
393-
{
394-
id: component.NewIDWithName(metadata.Type, ""),
395-
expected: &Config{
396-
AccessToken: "",
397-
Realm: "ap0",
398-
ClientConfig: confighttp.ClientConfig{
399-
Timeout: 10 * time.Second,
400-
Headers: map[string]configopaque.String{},
401-
MaxIdleConns: &hundred,
402-
MaxIdleConnsPerHost: &hundred,
403-
MaxConnsPerHost: &defaultMaxConnsPerHost,
404-
IdleConnTimeout: &idleConnTimeout,
405-
HTTP2ReadIdleTimeout: 10 * time.Second,
406-
HTTP2PingTimeout: 10 * time.Second,
407-
},
408-
BackOffConfig: configretry.BackOffConfig{
409-
Enabled: true,
410-
InitialInterval: 5 * time.Second,
411-
MaxInterval: 30 * time.Second,
412-
MaxElapsedTime: 5 * time.Minute,
413-
RandomizationFactor: backoff.DefaultRandomizationFactor,
414-
Multiplier: backoff.DefaultMultiplier,
415-
},
416-
QueueSettings: exporterhelper.NewDefaultQueueConfig(),
417-
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{
418-
AccessTokenPassthrough: true,
419-
},
420-
LogDimensionUpdates: false,
421-
DimensionClient: DimensionClientConfig{
422-
MaxBuffered: 10000,
423-
SendDelay: 10 * time.Second,
424-
MaxIdleConns: 20,
425-
MaxIdleConnsPerHost: 20,
426-
MaxConnsPerHost: 20,
427-
IdleConnTimeout: 30 * time.Second,
428-
Timeout: 10 * time.Second,
429-
},
430-
TranslationRules: nil,
431-
ExcludeMetrics: nil,
432-
IncludeMetrics: nil,
433-
DeltaTranslationTTL: 3600,
434-
ExcludeProperties: nil,
435-
Correlation: &correlation.Config{
436-
ClientConfig: confighttp.ClientConfig{
437-
Endpoint: "",
438-
Timeout: 5 * time.Second,
439-
Headers: map[string]configopaque.String{},
440-
MaxIdleConns: &defaultMaxIdleConns,
441-
MaxIdleConnsPerHost: &defaultMaxIdleConnsPerHost,
442-
MaxConnsPerHost: &defaultMaxConnsPerHost,
443-
IdleConnTimeout: &defaultIdleConnTimeout,
444-
},
445-
StaleServiceTimeout: 5 * time.Minute,
446-
SyncAttributes: map[string]string{
447-
"k8s.pod.uid": "k8s.pod.uid",
448-
"container.id": "container.id",
449-
},
450-
Config: apmcorrelation.Config{
451-
MaxRequests: 20,
452-
MaxBuffered: 10_000,
453-
MaxRetries: 2,
454-
LogUpdates: false,
455-
RetryDelay: 30 * time.Second,
456-
CleanupInterval: 1 * time.Minute,
457-
},
458-
},
459-
NonAlphanumericDimensionChars: "_-.",
460-
SendOTLPHistograms: false,
461-
},
462-
},
463287
}
464288

465289
for _, tt := range tests {
@@ -471,8 +295,6 @@ func TestEmptyAccessTokenPassValidate(t *testing.T) {
471295
require.NoError(t, err)
472296
require.NoError(t, sub.Unmarshal(cfg))
473297

474-
cfg.(*Config).AccessToken = ""
475-
476298
assert.NoError(t, component.ValidateConfig(cfg))
477299
// We need to add the default exclude rules.
478300
assert.NoError(t, setDefaultExcludes(tt.expected))

exporter/signalfxexporter/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
github.com/shirou/gopsutil/v4 v4.24.12
1818
github.com/signalfx/com_signalfx_metrics_protobuf v0.0.3
1919
github.com/stretchr/testify v1.10.0
20+
go.opentelemetry.io/collector/client v1.23.0
2021
go.opentelemetry.io/collector/component v0.117.0
2122
go.opentelemetry.io/collector/component/componenttest v0.117.0
2223
go.opentelemetry.io/collector/config/confighttp v0.117.0
@@ -71,7 +72,6 @@ require (
7172
github.com/tklauser/go-sysconf v0.3.12 // indirect
7273
github.com/tklauser/numcpus v0.6.1 // indirect
7374
github.com/yusufpapurcu/wmi v1.2.4 // indirect
74-
go.opentelemetry.io/collector/client v1.23.0 // indirect
7575
go.opentelemetry.io/collector/config/configauth v0.117.0 // indirect
7676
go.opentelemetry.io/collector/config/configcompression v1.23.0 // indirect
7777
go.opentelemetry.io/collector/config/configtelemetry v0.117.0 // indirect

0 commit comments

Comments
 (0)