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/datadog] Refactor Datadog Exporter to use logs agent exporter #32327

Merged
merged 69 commits into from
May 6, 2024

Conversation

liustanley
Copy link
Contributor

@liustanley liustanley commented Apr 11, 2024

Description:

This PR adds support for the logs agent exporter in order to export logs to Datadog. The following changes were made in order to support this:

Link to tracking Issue:

Fixes #30099

Testing:

Documentation:

@github-actions github-actions bot added cmd/configschema configschema command cmd/otelcontribcol otelcontribcol command connector/datadog exporter/datadog Datadog components labels Apr 11, 2024
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

exporter/datadogexporter/factory.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/logs/agent.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/logs/agent_core_init.go Outdated Show resolved Hide resolved
cmd/configschema/go.mod Outdated Show resolved Hide resolved
.chloggen/datadogexporter_logsagentexporter.yaml Outdated Show resolved Hide resolved
.chloggen/datadogexporter_peerserviceaggregation.yaml Outdated Show resolved Hide resolved
exporter/datadogexporter/agent_components.go Outdated Show resolved Hide resolved
exporter/datadogexporter/agent_components.go Outdated Show resolved Hide resolved
exporter/datadogexporter/config.go Show resolved Hide resolved
exporter/datadogexporter/internal/testutil/logs.go Outdated Show resolved Hide resolved
exporter/datadogexporter/logs_exporter.go Outdated Show resolved Hide resolved
exporter/datadogexporter/logs_exporter.go Outdated Show resolved Hide resolved
Config: cfgComponent,
Hostname: hostnameComponent,
})
err = logsAgent.Start(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

We are starting the logsAgent during component creation time. We should not do this, that's what exporterhelper.WithStart is used for

Copy link
Contributor Author

Choose a reason for hiding this comment

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

logsAgent.Start also sets up the pipeline channel that gets passed into the logsAgentExporter, and logsAgentExporter.ConsumeLogs gets passed into the exporterhelper at the end of createLogsExporter. Is there a way to set this all up while also using exporterhelper.WithStart? I don't think we follow this pattern elsewhere in the datadog exporter

Copy link
Member

Choose a reason for hiding this comment

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

Hm, so this has come up recently on open-telemetry/opentelemetry-collector/issues/10031. It's true that there are other things doing the wrong thing in our exporter, I will file a ticket for those. If we can solve this problem now for this one though it would be great not to make the problem worse.

exporter/datadogexporter/traces_exporter.go Outdated Show resolved Hide resolved
@liustanley liustanley requested a review from mx-psi May 2, 2024 19:45
exporter/datadogexporter/config.go Outdated Show resolved Hide resolved
exporter/datadogexporter/config.go Outdated Show resolved Hide resolved
.chloggen/datadogexporter_logsagentexporter.yaml Outdated Show resolved Hide resolved
exporter/datadogexporter/config.go Show resolved Hide resolved
exporter/datadogexporter/config.go Show resolved Hide resolved
exporter/datadogexporter/factory.go Outdated Show resolved Hide resolved
exporter/datadogexporter/factory.go Outdated Show resolved Hide resolved
exporter/datadogexporter/factory.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/logs/hostnameimpl.go Outdated Show resolved Hide resolved
exporter/datadogexporter/internal/logs/hostnameimpl.go Outdated Show resolved Hide resolved
exporter/datadogexporter/logs_exporter_test.go Outdated Show resolved Hide resolved
Config: cfgComponent,
Hostname: hostnameComponent,
})
err = logsAgent.Start(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Hm, so this has come up recently on open-telemetry/opentelemetry-collector/issues/10031. It's true that there are other things doing the wrong thing in our exporter, I will file a ticket for those. If we can solve this problem now for this one though it would be great not to make the problem worse.

liustanley and others added 4 commits May 3, 2024 09:59
@liustanley liustanley requested a review from mx-psi May 3, 2024 15:16
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.

One small comment and we are done! 🚀

exporter/datadogexporter/config.go Outdated Show resolved Hide resolved
@mx-psi mx-psi merged commit b270022 into open-telemetry:main May 6, 2024
162 checks passed
@mx-psi mx-psi deleted the stanley.liu/logsagentexporter branch May 6, 2024 09:34
@github-actions github-actions bot added this to the next release milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[exporter/datadog] Migrate logs exporter from HTTP client to logs agent
4 participants