Skip to content

[receiver/github] add repository custom properties as resource attributes#40878

Merged
mx-psi merged 22 commits into
open-telemetry:mainfrom
krzko:feat-receiver-github-custom-properties
Jul 14, 2025
Merged

[receiver/github] add repository custom properties as resource attributes#40878
mx-psi merged 22 commits into
open-telemetry:mainfrom
krzko:feat-receiver-github-custom-properties

Conversation

@krzko

@krzko krzko commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Description

This PR enhances the GitHub receiver by adding support for custom properties from GitHub repositories as resource attributes. The implementation extracts all key-value pairs from the repository's CustomProperties map and adds them as resource attributes with the prefix github.repository.custom_properties.

For example, if a repository has custom properties like team_name: "open-telemetry" and environment: "development", they will be added as resource attributes:

github.repository.custom_properties.team_name = "open-telemetry"
github.repository.custom_properties.environment = "development"

The implementation handles different value types (string, int, float, bool) appropriately and follows the OpenTelemetry convention for attribute naming, similar to how HTTP headers are handled.

Link to tracking issue

Fixes: TBD

Testing

Added unit tests for the new functionality in model_test.go. The tests verify:

  • String properties are correctly added as resource attributes
  • Different types (string, int, float, bool) are handled correctly
  • The "service_name" property is skipped (as it's handled separately)
  • Empty and nil maps are handled properly

All tests are passing, confirming the implementation works as expected.

Documentation

TBD

@krzko krzko changed the title feat: add github repository custom property extraction feat: add github repository custom properties extraction Jun 25, 2025
@krzko krzko changed the title feat: add github repository custom properties extraction feat(receiver/github): add repository custom properties extraction Jun 26, 2025
Comment thread .chloggen/githubreceiver-add-repository-custom-properties.yaml Outdated
Comment thread receiver/githubreceiver/model.go

@adrielp adrielp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall, looks pretty good. Appreciate the addition of the tests. I left a couple nits and a suggestion around end-user documentation so that it's very clear to the end user how their custom properties are going to show up.

@krzko

krzko commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

Overall, looks pretty good. Appreciate the addition of the tests. I left a couple nits and a suggestion around end-user documentation so that it's very clear to the end user how their custom properties are going to show up.

Not a problem at all.

I updated the change log gen and added a readme update about the functionality of the custom prooperties generation as well.

@adrielp

adrielp commented Jul 3, 2025

Copy link
Copy Markdown
Member

Let's fix the test failures. A lot of the linting/testing can be run locally with make {lint, fmt} etc.

@krzko

krzko commented Jul 4, 2025

Copy link
Copy Markdown
Contributor Author

Fixed up the linting, formatting issues on top of the golden file tests as well.

Comment thread receiver/githubreceiver/README.md Outdated
Comment thread receiver/githubreceiver/README.md Outdated
Comment thread receiver/githubreceiver/README.md Outdated
@krzko krzko changed the title feat(receiver/github): add repository custom properties extraction [receiver/github] add repository custom properties as resource attributes Jul 11, 2025
@mx-psi mx-psi merged commit 48498e5 into open-telemetry:main Jul 14, 2025
178 checks passed
@github-actions github-actions Bot added this to the next release milestone Jul 14, 2025
@krzko krzko deleted the feat-receiver-github-custom-properties branch July 14, 2025 12:14
Dylan-M pushed a commit to Dylan-M/opentelemetry-collector-contrib that referenced this pull request Aug 5, 2025
…utes (open-telemetry#40878)

#### Description

This PR enhances the GitHub receiver by adding support for custom
properties from GitHub repositories as resource attributes. The
implementation extracts all key-value pairs from the repository's
`CustomProperties` map and adds them as resource attributes with the
prefix `github.repository.custom_properties`.

For example, if a repository has custom properties like `team_name:
"open-telemetry"` and `environment: "development"`, they will be added
as resource attributes:

```
github.repository.custom_properties.team_name = "open-telemetry"
github.repository.custom_properties.environment = "development"
```

The implementation handles different value types (string, int, float,
bool) appropriately and follows the OpenTelemetry convention for
attribute naming, similar to how HTTP headers are handled.

#### Link to tracking issue

Fixes: TBD

#### Testing

Added unit tests for the new functionality in `model_test.go`. The tests
verify:

* String properties are correctly added as resource attributes
* Different types (string, int, float, bool) are handled correctly
* The "service_name" property is skipped (as it's handled separately)
* Empty and nil maps are handled properly

All tests are passing, confirming the implementation works as expected.

#### Documentation

TBD
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.

4 participants