Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .chloggen/signalfxexporter-drop-tags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: exporter/signalfx

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Makes sending tags from SignalFx Exporter configurable"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [43799]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
New optional configuration flag `drop_tags` has been added to SignalFx Exporter to allow users to disable tag metadata sending.
This feature has been introduced due to a common issue among Splunk Observability customers when they're receiving more tags
than allowed limit.



# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
5 changes: 3 additions & 2 deletions exporter/signalfxexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ The following configuration options are required:

- `access_token` (no default): The access token is the [authentication token
provided by Splunk Observability
Cloud](https://docs.splunk.com/observability/en/admin/authentication/authentication-tokens/manage-usage.html).
Cloud](https://help.splunk.com/en/splunk-observability-cloud/administer/authentication-and-security/authentication-tokens/manage-usage-with-access-tokens).
The access token can be obtained from the web app.
- Either `realm` or both `api_url` and `ingest_url`. Both `api_url` and
`ingest_url` take precedence over `realm`.
- `realm` (no default): SignalFx realm where the data will be received.
- `api_url` (no default): Destination to which [properties and
tags](https://docs.splunk.com/observability/en/metrics-and-metadata/metrics-finder-metadata-catalog.html)
tags](https://help.splunk.com/en/splunk-observability-cloud/data-tools/metric-finder-and-metadata-catalogue)
are sent. If `realm` is set, this option is derived and will be
`https://api.{realm}.signalfx.com`. If a value is explicitly set, the
value of `realm` will not be used in determining `api_url`. The explicit
Expand Down Expand Up @@ -128,6 +128,7 @@ The following configuration options can also be configured:
- `max_conns_per_host` (default = 20): The maximum total number of connections the client can keep open per host.
- `idle_conn_timeout` (default = 30s): The maximum amount of time an idle connection will remain open before closing itself.
- `timeout` (default = 10s): Amount of time to wait for the dimension HTTP request to complete.
- `drop_tags` (default = false): Flag that indicates whether to drop the tags from the metadata sent to Splunk Observability Cloud by the exporter.
- `nonalphanumeric_dimension_chars`: (default = `"_-."`) A string of characters
that are allowed to be used as a dimension key in addition to alphanumeric
characters. Each nonalphanumeric dimension key character that isn't in this string
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type DimensionClientConfig struct {
MaxConnsPerHost int `mapstructure:"max_conns_per_host"`
IdleConnTimeout time.Duration `mapstructure:"idle_conn_timeout"`
Timeout time.Duration `mapstructure:"timeout"`
DropTags bool `mapstructure:"drop_tags"`
}

func (cfg *Config) getMetricTranslator(done chan struct{}) (*translation.MetricTranslator, error) {
Expand Down
2 changes: 2 additions & 0 deletions exporter/signalfxexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func TestLoadConfig(t *testing.T) {
MaxConnsPerHost: 20,
IdleConnTimeout: 30 * time.Second,
Timeout: 10 * time.Second,
DropTags: false,
},
ExcludeMetrics: nil,
IncludeMetrics: nil,
Expand Down Expand Up @@ -163,6 +164,7 @@ func TestLoadConfig(t *testing.T) {
MaxConnsPerHost: 10000,
IdleConnTimeout: 2 * time.Hour,
Timeout: 20 * time.Second,
DropTags: false,
},
ExcludeMetrics: []dpfilters.MetricFilter{
{
Expand Down
1 change: 1 addition & 0 deletions exporter/signalfxexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (se *signalfxExporter) start(ctx context.Context, host component.Host) (err
MaxIdleConnsPerHost: se.config.DimensionClient.MaxIdleConnsPerHost,
IdleConnTimeout: se.config.DimensionClient.IdleConnTimeout,
Timeout: se.config.DimensionClient.Timeout,
DropTags: se.config.DimensionClient.DropTags,
})
dimClient.Start()

Expand Down
9 changes: 9 additions & 0 deletions exporter/signalfxexporter/internal/dimensions/dimclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type DimensionClient struct {
metricsConverter translation.MetricsConverter
// ExcludeProperties will filter DimensionUpdate content to not submit undesired metadata.
ExcludeProperties []dpfilters.PropertyFilter
// dropTags specifies whether tags should be omitted or not. Default value is false.
dropTags bool
}

type queuedDimension struct {
Expand All @@ -82,6 +84,7 @@ type DimensionClientOptions struct {
MaxIdleConnsPerHost int
IdleConnTimeout time.Duration
Timeout time.Duration
DropTags bool
}

// NewDimensionClient returns a new client
Expand Down Expand Up @@ -118,6 +121,7 @@ func NewDimensionClient(options DimensionClientOptions) *DimensionClient {
logUpdates: options.LogUpdates,
metricsConverter: options.MetricsConverter,
ExcludeProperties: options.ExcludeProperties,
dropTags: options.DropTags,
}
}

Expand Down Expand Up @@ -342,6 +346,11 @@ func (dc *DimensionClient) makePatchRequest(ctx context.Context, dim *DimensionU
}

func (dc *DimensionClient) filterDimensionUpdate(update *DimensionUpdate) *DimensionUpdate {
// clear tags list if dropTags option is set
if dc.dropTags {
update.Tags = nil
}

for _, excludeRule := range dc.ExcludeProperties {
if excludeRule.DimensionName.Matches(update.Name) && excludeRule.DimensionValue.Matches(update.Value) {
for k, v := range update.Properties {
Expand Down
35 changes: 35 additions & 0 deletions exporter/signalfxexporter/internal/dimensions/dimclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,41 @@ func TestDimensionClient(t *testing.T) {
require.EqualValues(t, 1, server.requestCount.Load())
})

t.Run("send dimension without tags if dropTags option is set", func(t *testing.T) {
server.reset()
// set dropTags option
client.dropTags = true
defer func() { client.dropTags = false }()

require.NoError(t, client.acceptDimension(&DimensionUpdate{
Name: "host",
Value: "test-box",
Properties: map[string]*string{
"a": newString("b"),
"c": newString("d"),
"e": nil,
},
Tags: map[string]bool{
"active": true,
"terminated": false,
},
}))

server.handleRequest()
require.Equal(t, []dim{
{
Key: "host",
Value: "test-box",
Properties: map[string]*string{
"a": newString("b"),
"c": newString("d"),
"e": nil,
},
},
}, server.acceptedDims)
require.EqualValues(t, 1, server.requestCount.Load())
})

t.Run("send a distinct prop/tag set for existing dim with server error", func(t *testing.T) {
server.reset()
server.respCode = http.StatusInternalServerError
Expand Down