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 initial info on how to write a component #88

Merged

Conversation

pjanotti
Copy link
Contributor

@pjanotti pjanotti commented Jan 3, 2020

Provide a bit more of information for people interested in writing components for the collector. This is just to provide the initial guidelines a give a ballpark of what needs to be done.

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding this.

core repository and core distribution of the Collector.
[core repository](https://github.com/open-telemetry/opentelemetry-collector) and
core distribution of the Collector. Typically, these contributions are vendor
specific receivers/exporters and/or components that are either legacy or are only
Copy link
Member

Choose a reason for hiding this comment

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

Nit: do we need to specifically mention "legacy" here? I think this sentence reads fine and serves the purpose without that reference.

- Each component has its own go.mod file. This allows custom builds of the
collector to take a limited sets of dependencies - so run `go mod` commands as
appropriate for your component.
- Implement the needed interface on your component by importing the appropriate
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a note here saying that while Collector is in Alpha stage the interfaces may undergo breaking changes and they must be ready to fix their component when such changes happen otherwise the component will be excluded from the default builds.

component from the core repo.
 Follow the pattern of existing components regarding
config and factory soruce files and tests.

- Implement your component as appropriate. Provide end-to-end tests (or mock
backend/client as appropriate). Target is to get 80% of code coverage.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
backend/client as appropriate). Target is to get 80% of code coverage.
backend/client as appropriate). Target is to get 80% or more of code coverage.

I'd prefer to remove the reference to specific percentage once we will implement ratcheting based on coverage percentage (to fail the build if coverage goes down).

rules and there are exceptions to them, but, take care considering when you are
not following them.

- Avoid introducing asynchronicity on receivers and exporters. Typically, these
Copy link
Member

Choose a reason for hiding this comment

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

It may be worth explaining what "asynchronicity" means in this context.

reused by other receivers and exporters).
- When implementing exporters try to leverage the exporter helpers from the core
repo, see [exporterhelper package](https://github.com/open-telemetry/opentelemetry-collector/tree/master/exporter/exporterhelper)
on core repo.
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a rationale as to why this is a good thing to do?

@tigrannajaryan tigrannajaryan merged commit 3faee11 into open-telemetry:master Jan 6, 2020
[core repository](https://github.com/open-telemetry/opentelemetry-collector) and
core distribution of the Collector. Typically, these contributions are vendor
specific receivers/exporters and/or components that are either legacy or are only
useful to relatively small number of users.
Copy link
Contributor

Choose a reason for hiding this comment

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

to a

@pjanotti pjanotti deleted the add-how-to-write-an-exporter branch January 16, 2020 18:36
pjanotti pushed a commit to pjanotti/opentelemetry-service-contrib that referenced this pull request Jan 16, 2020
There was some feedback from initial PR that was not incorporated, see open-telemetry#88
tigrannajaryan pushed a commit that referenced this pull request Jan 16, 2020
There was some feedback from initial PR that was not incorporated, see #88
mxiamxia referenced this pull request in mxiamxia/opentelemetry-collector-contrib Jul 22, 2020
* Adds factory and new-style config for Logging exporter.

* Add a todo for configuring log level
ljmsc referenced this pull request in ljmsc/opentelemetry-collector-contrib Feb 21, 2022
Some code got moved, so reflect that in the README.
bogdandrutu pushed a commit that referenced this pull request May 12, 2022
codeboten pushed a commit that referenced this pull request Nov 23, 2022
jj22ee pushed a commit to jj22ee/opentelemetry-collector-contrib that referenced this pull request Sep 21, 2023
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.

None yet

4 participants