Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exporter/signalfx: Add translation rule to drop dimensions #2660

Merged

Conversation

asuresh4
Copy link
Member

@asuresh4 asuresh4 commented Mar 11, 2021

Description: Add drop_dimension translation rule. Below are the various ways the
rule can be configured

# drops dimensions from `k8s.pod.phase`
- action: drop_dimensions
  metric_names:
    k8s.pod.phase: true
  dimension_pairs:
    dim_key1:
    dim_key2: [dim_val1, dim_val2]
# drops dimensions from all metrics
- action: drop_dimensions
  dimension_pairs:
    dim_key1:
# drops dimensions from metrics that match the given pattern
- action: drop_dimensions
  metric_name: /^k8s\..*/
  dimension_pairs:
    dim_key: [dim_value]

Also, a drop_dimension rule has been added to the default list of translations.
The rule drops opencensus.resourcetype dimension from metrics generated by receivers written
using OC data structures. This rule can be removed once the k8s_cluster and kubeletstats
receivers have been refactored to use pdata.Metrics. Right now these dimensions are added as a
result of the conversion here.
Dropping these dimensions will ensure MTSes aren't broken when the receivers are refactored
to use pdata.Metrics and this resource type dimension will cease to exist.

Testing: Added tests

Documentation: Added inline comments.

@asuresh4 asuresh4 requested a review from a team March 11, 2021 22:06
@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #2660 (a8583f7) into main (55d2be2) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2660   +/-   ##
=======================================
  Coverage   91.41%   91.42%           
=======================================
  Files         435      435           
  Lines       21619    21655   +36     
=======================================
+ Hits        19763    19798   +35     
  Misses       1390     1390           
- Partials      466      467    +1     
Flag Coverage Δ
integration 69.18% <ø> (-0.07%) ⬇️
unit 90.33% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ignalfxexporter/translation/dpfilters/datapoint.go 100.00% <100.00%> (ø)
...gnalfxexporter/translation/dpfilters/dimensions.go 100.00% <100.00%> (ø)
...r/signalfxexporter/translation/dpfilters/string.go 100.00% <100.00%> (ø)
...xporter/signalfxexporter/translation/translator.go 96.30% <100.00%> (+0.42%) ⬆️
receiver/k8sclusterreceiver/watcher.go 95.29% <0.00%> (-2.36%) ⬇️
receiver/carbonreceiver/transport/tcp_server.go 67.00% <0.00%> (+1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55d2be2...a8583f7. Read the comment docs.

@jrcamp jrcamp assigned dmitryax and unassigned kbrockhoff Mar 11, 2021
@asuresh4 asuresh4 force-pushed the sfxexporter-opencensus-dimension branch from 0686a39 to 3463eb0 Compare March 12, 2021 16:50
Add `drop_dimension` translation rule. Below are the various ways the
rule can be configured

```yaml
- action: drop_dimensions
  metric_names:
    k8s.pod.phase: true
  without_dimension_pairs:
    dim_key1:
    dim_key2: [dim_val1, dim_val2]
- action: drop_dimensions
  without_dimension_pairs:
    dim_key1:
- action: drop_dimensions
  metric_name: /^k8s\..*/
  without_dimension_pairs:
    dim_key: [dim_value]
```

Also, a `drop_dimension` rule has been added to the default list of translations.
The rule drops `opencensus.resourcetype` dimension from metrics generated by receivers written
using OC data structures. This rule can be removed once the `k8s_cluster` and `kubeletstats`
receivers have been refactored to use `pdata.Metrics`. Right now these dimensions are added as a
result of the conversion [here](https://github.com/open-telemetry/opentelemetry-collector/blob/v0.22.0/translator/internaldata/oc_to_resource.go#L128).
Dropping these dimensions will ensure MTSes aren't broken when the receivers are refactored
to use `pdata.Metrics` and this resource type dimension will cease to exist.
@asuresh4 asuresh4 force-pushed the sfxexporter-opencensus-dimension branch from 3463eb0 to bf6b9cc Compare March 12, 2021 16:53
@asuresh4 asuresh4 force-pushed the sfxexporter-opencensus-dimension branch from 607e235 to a8583f7 Compare March 12, 2021 19:17
Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bogdandrutu bogdandrutu merged commit 3ec08e1 into open-telemetry:main Mar 12, 2021
pmatyjasek-sumo referenced this pull request in pmatyjasek-sumo/opentelemetry-collector-contrib Apr 28, 2021
* exporter/signalfx: Add translation rule to drop dimensions

Add `drop_dimension` translation rule. Below are the various ways the
rule can be configured

```yaml
- action: drop_dimensions
  metric_names:
    k8s.pod.phase: true
  without_dimension_pairs:
    dim_key1:
    dim_key2: [dim_val1, dim_val2]
- action: drop_dimensions
  without_dimension_pairs:
    dim_key1:
- action: drop_dimensions
  metric_name: /^k8s\..*/
  without_dimension_pairs:
    dim_key: [dim_value]
```

Also, a `drop_dimension` rule has been added to the default list of translations.
The rule drops `opencensus.resourcetype` dimension from metrics generated by receivers written
using OC data structures. This rule can be removed once the `k8s_cluster` and `kubeletstats`
receivers have been refactored to use `pdata.Metrics`. Right now these dimensions are added as a
result of the conversion [here](https://github.com/open-telemetry/opentelemetry-collector/blob/v0.22.0/translator/internaldata/oc_to_resource.go#L128).
Dropping these dimensions will ensure MTSes aren't broken when the receivers are refactored
to use `pdata.Metrics` and this resource type dimension will cease to exist.

* Address feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants