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 Agentless Datadog Trace Exporter #38

Closed
wants to merge 61 commits into from

Conversation

ericmustin
Copy link

This is probably at a point where it could benefit from review, cc @mx-psi , some things to note:

  • There's still some uncertainty around a few trace's span translation choices, as well as how to grab the global config stuff like hostname and env and apply it to the trace payloads (as well as the order of precedence for things like DD_SERVICE as opposed to the service already set by the tracer). but for the most part the implementation is complete, as is the flushing of trace and stats payloads.

  • the most of what's in /apm, including tests and the snapshots, i've just grabbed from serverless. I tried to remove everything that wasn't being used by our implementation, but didn't update the serverless tests, so they'll probably fail.

  • The big things here are going to be:

    • having a better set of eyes around my very hacky Go code. Anything you see that looks unusual, or could be optimised, there's likely not a good reason i've chosen not to, it's just because i don't know Go especially well.
    • The implementation itself around converting Internal Traces to Datadog Traces largely follows the approach the Zipkin Exporter took. There are a few things zipkin is doing that we don't support and vice versa but the methods and code paths are similar.
    • The conventions of the coercing the internal spans to datadog spans largely follow the python exporter's translation implementation, while the conventions and approach around generating+aggregating+flushing trace+stats payloads is largely based on the serverless implementation. As i mentioned previously, I more or less ported everything in /apm directly from that repo.
    • I've been testing this locally using our otel-collector-e2e-tests package, lmk if you have any trouble with that.
    • How to appropriately manage the config. it's possible my approach has drifted from what we've ended up doing in the metric exporter.
    • Tests are going to be a hassle, If you see any shortcuts here or good similar test setups in other parts of the repo that I can use as a guide, let me know. I will try to start writing tests for this stuff next

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

I reviewed some parts of the code and left a few comments so that you can keep working on this; most importantly I think you need to run make fmt and make to run all the linters and tests that can help catch errors (we will need them to pass to have a PR accepted upstream)

exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Second round; impi (after running make fmt) and misspell still give some errors that need to be addressed

exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/traces_exporter.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/apm/model.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/apm/model.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/apm/trace-connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/apm/model.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
@NathanBaulch
Copy link

NathanBaulch commented Sep 30, 2020

Well that's annoying, I just stumbled on this branch/PR after successfully migrating the tracing portion of opencensus-go-exporter-datadog to OpenTelemetry here. I admit it did seem weird that this work hadn't been done already (at least not somewhere easily discoverable).

Oh well, mine works but is just a minimal 1-1 (where possible) port, so I look forward to this official one being released. 👍

While I'm here (and sorry if off-topic), I'm curious about the pros and cons of an OTEL exporter vs an OTEL API compatible wrapper as used in dd-trace-go (example)?

Also, does "agentless" mean it'll go direct to datadoghq without dd-agent? Thanks.

@ericmustin
Copy link
Author

@NathanBaulch the goal here is we really need to be able to live in the otel-collector. simply put, existing otel users likely aren't going to want to run a datadog agent along with an opentelemetry-collector (maybe they will? we plan to add agent export as well down the road). So, yes agentless means direct to api intake. We're still iterating here, as circumventing the agent and our own tracing clients introduces a whole can of worms around metric computation but we hope to have a PR in with the Otel folks by EOW.

as far as the pros and cons of an OTEL exporter vs an OTEL API compatible wrapper, i think it's different use cases, an OTEL Exporter that lives in the opentelemetry-collector would be language agnostic but require the opentelemetry collector to be running, whereas the OTEL API Compatibility wrapper would leverage existing DD tracing architecture.

Sorry to hear about the duped work (nice work tho, fwiw!), but we can certainly keep you updated here on how this work is going and we'd love any feedback.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Looking better! I left some more comments, I think we would benefit from some unit test coverage at this point. One thing I am worried about is that the Agent might spam logs when importing its packages/running its internal functions, have you noticed anything in the end to end tests?

exporter/datadogexporter/trace_connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/trace_connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/trace_connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/stats.go Outdated Show resolved Hide resolved
exporter/datadogexporter/traces_exporter.go Show resolved Hide resolved
exporter/datadogexporter/model.go Outdated Show resolved Hide resolved
exporter/datadogexporter/model.go Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
@ericmustin
Copy link
Author

ericmustin commented Oct 2, 2020

@mx-psi I tried to address most of the feedback and add unit tests for the span/trace translation work. Some of the trace connection stuff is still not covered in tests, I think I have to wire up a mock server for some of that, and I wasn't totally sure how to manage merging up the config tags. But punting on those bits for now so I can work on rebasing off the most up to date metrics exporter work so that the config is in a good place. I'd also like to start gameplanning on how to start the upstream PR process if you think this is in a reasonably good place, so let me know if there are other areas here where the code needs to be fixed before that.

@ericmustin
Copy link
Author

Added some additional tests, rebasing off master brought in a bunch of changes to metric stuff that probably is now out of date. Going to wait for your metrrics PR and try to rebase off that branch

@ericmustin
Copy link
Author

@mx-psi So i think this is pretty much in a good state, i added mock server tests to test the trace connection so i think our code coverage is pretty good at this point. I just need to rebase off master + your metric exporter work

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Looks good, I have yet to test it on the backend but since you already did I am going to approve. I left a bunch of small typos to fix/TODOs that can be removed too.

exporter/datadogexporter/model.go Outdated Show resolved Hide resolved
exporter/datadogexporter/trace_connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/trace_connection.go Outdated Show resolved Hide resolved
exporter/datadogexporter/traces_exporter.go Outdated Show resolved Hide resolved
exporter/datadogexporter/traces_exporter.go Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
exporter/datadogexporter/translate_traces.go Outdated Show resolved Hide resolved
ericmustin and others added 21 commits October 5, 2020 13:32
)

Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/klauspost/compress/releases)
- [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml)
- [Commits](klauspost/compress@v1.11.0...v1.11.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.33 to 1.35.2.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-go@v1.34.33...v1.35.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.32 to 1.35.2.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-go@v1.34.32...v1.35.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
#1193)

Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.33 to 1.35.2.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-go@v1.34.33...v1.35.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/signalfx/sapm-proto](https://github.com/signalfx/sapm-proto) from 0.6.0 to 0.6.2.
- [Release notes](https://github.com/signalfx/sapm-proto/releases)
- [Commits](signalfx/sapm-proto@v0.6.0...v0.6.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/shirou/gopsutil](https://github.com/shirou/gopsutil) from 2.20.8+incompatible to 2.20.9+incompatible.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](shirou/gopsutil@v2.20.8...v2.20.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1198)

Bumps [github.com/shirou/gopsutil](https://github.com/shirou/gopsutil) from 2.20.6+incompatible to 2.20.9+incompatible.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](shirou/gopsutil@v2.20.6...v2.20.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…or (#1196)

Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.34.32 to 1.35.2.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-go@v1.34.32...v1.35.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1178)

* Add metrics translation functions

* Improve docs and make newGauge private

* Add basic hostname resolution
This will be expanded in the future to more closely replicate the
Datadog Agent behavior

* Remove Series struct and use []datadog.Metric
We can add it back if necessary in the future
@mx-psi
Copy link
Member

mx-psi commented Oct 23, 2020

Should we close this now that it is available upstream?

@ericmustin ericmustin closed this Oct 24, 2020
KSerrania pushed a commit that referenced this pull request May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants