Skip to content

Conversation

bdewater-thatch
Copy link

This implements a resource detector for the Render platform. I used the AWS EC2 implementation and Heroku conventions as inspiration.

Docs:

@bdewater-thatch bdewater-thatch changed the title Render resource detector feat: Render resource detector Sep 11, 2025
@bdewater-thatch bdewater-thatch changed the title feat: Render resource detector feat: add Render resource detector Sep 11, 2025
if ENV.fetch('RENDER', false) == 'true'
resource_attributes[RESOURCE::CLOUD_PROVIDER] = 'render'
resource_attributes['render.is_pull_request'] = ENV.fetch('IS_PULL_REQUEST', 'false')
resource_attributes['render.git.branch'] = ENV.fetch('RENDER_GIT_BRANCH', nil)

Choose a reason for hiding this comment

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

Should be vcs.ref.head.name

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, will change.

resource_attributes[RESOURCE::CLOUD_PROVIDER] = 'render'
resource_attributes['render.is_pull_request'] = ENV.fetch('IS_PULL_REQUEST', 'false')
resource_attributes['render.git.branch'] = ENV.fetch('RENDER_GIT_BRANCH', nil)
resource_attributes['render.git.repo_slug'] = ENV.fetch('RENDER_GIT_REPO_SLUG', nil)

Choose a reason for hiding this comment

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

Could we construct a vcs.repository.url.full using the slug?

Copy link
Author

Choose a reason for hiding this comment

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

No. Render supports multiple git backend but does not expose this information via an environment variable.

Choose a reason for hiding this comment

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

In that case I would suggest vcs.repository.slug and get the attribute defined.

resource_attributes['render.git.repo_slug'] = ENV.fetch('RENDER_GIT_REPO_SLUG', nil)
resource_attributes[RESOURCE::SERVICE_INSTANCE_ID] = ENV.fetch('RENDER_INSTANCE_ID', nil)
resource_attributes[RESOURCE::SERVICE_NAME] = ENV.fetch('RENDER_SERVICE_NAME', 'unknown_service')
resource_attributes[RESOURCE::SERVICE_VERSION] = ENV.fetch('RENDER_GIT_COMMIT', nil)

Choose a reason for hiding this comment

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

Should this not be using a vcs.ref.head.revision attribute instead?

Copy link
Author

Choose a reason for hiding this comment

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

I think both can apply, eg we deploy from main and do not have any other kind of version identifier for our app. Software like GitLab does have a version number and a revision, so I'll change this to allow for that kind of thing.

Choose a reason for hiding this comment

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

For me usually the service attributes should be driven by the application and not by the build/deployment system. Maybe you could use artifact.name/version to capture these variables.

@arielvalentin
Copy link
Contributor

Thank you for this contribution. I am personally not a user of the Render platform nor part of their engineering team.

I do not know much about this platform so I am a little reluctant to add it to the contrib repo.

What level of commitment would you be able to provide for ongoing maintenance of this resource detector?

Do you have any contacts at render that would be willing to take ownership or maintenance of this long term?

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.

3 participants