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

Add metric metadata syncer to SignalFx exporter #231

Merged
merged 16 commits into from
May 26, 2020
Merged

Add metric metadata syncer to SignalFx exporter #231

merged 16 commits into from
May 26, 2020

Conversation

asuresh4
Copy link
Member

@asuresh4 asuresh4 commented May 12, 2020

Description: Added ability to sync properties and tags in SignalFx exporter. To begin with the exporter will be able to handle metadata updates from k8sclusterreceiver. The dimension updates are however handled in a generic manner to support similar metadata from other receivers. The dimension client used to perform the metric metadata sync is mostly a 1:1 port of https://github.com/signalfx/signalfx-agent/blob/master/pkg/core/writer/dimensions/client.go, with the primary difference being that deduplication of dimension updates are not currently supported in this exporter.

Link to tracking Issue: #180

Testing: Added unit tests and manual testing.

@asuresh4 asuresh4 requested a review from a team as a code owner May 12, 2020 16:59
@asuresh4 asuresh4 marked this pull request as draft May 12, 2020 17:00
@codecov-io
Copy link

codecov-io commented May 12, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@a1020fa). Click here to learn what that means.
The diff coverage is 81.45%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #231   +/-   ##
=========================================
  Coverage          ?   78.16%           
=========================================
  Files             ?      130           
  Lines             ?     6828           
  Branches          ?        0           
=========================================
  Hits              ?     5337           
  Misses            ?     1194           
  Partials          ?      297           
Impacted Files Coverage Δ
.../signalfxexporter/dimensions/kubernetesmetadata.go 65.95% <65.95%> (ø)
...ter/signalfxexporter/dimensions/dimensionupdate.go 75.00% <75.00%> (ø)
exporter/signalfxexporter/dimensions/dimclient.go 82.69% <82.69%> (ø)
exporter/signalfxexporter/dimensions/requests.go 84.48% <84.48%> (ø)
exporter/signalfxexporter/config.go 81.39% <88.23%> (ø)
exporter/signalfxexporter/exporter.go 86.53% <100.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 a1020fa...563685d. Read the comment docs.

@asuresh4 asuresh4 marked this pull request as ready for review May 12, 2020 22:54
// For easier unit testing
now func() time.Time

// TODO: Send these counters as internal metrics to SignalFx
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we could expose these through obsreport or some central mechanism. Maybe also TODO to add tracing support?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tracing support as in collect spans from the DimensionClient?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, no I mean just self-instrumentation with traces through obsreport.

@bogdandrutu
Copy link
Member

This PR depends on #214, will rebase once that's merged.

Is that done? If yes please update description.

@asuresh4
Copy link
Member Author

I just realized I haven't handled metadata updates to the same dimension within a small amount of time gracefully. Will get an update in for that shortly.

@tigrannajaryan tigrannajaryan added this to In progress in Collector via automation May 19, 2020
@asuresh4 asuresh4 requested a review from dmitryax May 21, 2020 16:31
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.

Looks like dimclient.go is not covered well with tests here. I see that there is client_test.go in signalfx repo. Do we plan to add them later?

exporter/signalfxexporter/exporter_test.go Show resolved Hide resolved
@asuresh4
Copy link
Member Author

Looks like dimclient.go is not covered well with tests here. I see that there is client_test.go in signalfx repo. Do we plan to add them later?

Will add those tests as well.

@asuresh4 asuresh4 requested a review from dmitryax May 21, 2020 20:12
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.

Overall looks good to me

exporter/signalfxexporter/exporter.go Outdated Show resolved Hide resolved
exporter/signalfxexporter/dimensions/dimclient.go Outdated Show resolved Hide resolved
exporter/signalfxexporter/dimensions/dimclient.go Outdated Show resolved Hide resolved
}

// setPropertiesOnDimension will set custom properties on a specific dimension value.
func (dc *DimensionClient) setPropertiesOnDimension(dimUpdate *DimensionUpdate) error {
Copy link
Member

Choose a reason for hiding this comment

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

The name sounds a bit confusing. May be something like sendDimensionUpdate or dispatchDimensionUpdate? What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed the method handleDimensionUpdate. Since the actual sending/dispatching is done by the method called makePatchRequest.

err error
)

if dimUpdate.Name == "" || dimUpdate.Value == "" {
Copy link
Member

Choose a reason for hiding this comment

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

should we check this earlier? in acceptDimension or even in PushKubernetesMetadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved it for now since it seems to make more sense. When the export supports metadata updates from other sources as well, we may want to refactor.

@asuresh4 asuresh4 requested a review from dmitryax May 22, 2020 17:13
Collector automation moved this from In progress to Reviewer approved May 22, 2020
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

@tigrannajaryan
Copy link
Member

@asuresh4 Please resolve the conflicts.

@asuresh4
Copy link
Member Author

@asuresh4 Please resolve the conflicts.

Done.

@tigrannajaryan tigrannajaryan merged commit 11a5dad into open-telemetry:master May 26, 2020
Collector automation moved this from Reviewer approved to Done May 26, 2020
@asuresh4 asuresh4 deleted the sfxexporter-k8s branch May 26, 2020 16:24
wyTrivail referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 13, 2020
Added ability to sync properties and tags in SignalFx exporter. To begin with the exporter will be able to handle metadata updates from `k8sclusterreceiver`. The dimension updates are however handled in a generic manner to support similar metadata from other receivers. The dimension client used to perform the metric metadata sync is mostly a 1:1 port of https://github.com/signalfx/signalfx-agent/blob/master/pkg/core/writer/dimensions/client.go, with the primary difference being that deduplication of dimension updates are not currently supported in this exporter.

**Link to tracking Issue:** open-telemetry#180

**Testing:** Added unit tests and manual testing.
mxiamxia referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 22, 2020
* Support metrics exporter with oc exporter config

Also remove outdated v1 configs and fix tests.

Updates #231.

* Fix static check

* Add documentation

* Send proto metrics with ExportMetricsServiceRequest()

Fixes #231.

* Remove config TOC

* Add document to config.go
ljmsc referenced this pull request in ljmsc/opentelemetry-collector-contrib Feb 21, 2022
bogdandrutu pushed a commit that referenced this pull request May 12, 2022
Bumps [go.opentelemetry.io/collector](https://github.com/open-telemetry/opentelemetry-collector) from 0.30.1 to 0.31.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-collector@v0.30.1...v0.31.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/collector
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Collector
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants