Skip to content

Conversation

fredr
Copy link
Member

@fredr fredr commented Oct 10, 2025

Adds the ground work for adding metrics to encore.ts, adds the e_requests_total counter for apps running in gcp/encore cloud that export metrics to gcp cloud monitoring.

Will add support for aws, datadog and prometheus in a follow up.
This also doesnt expose any sys metrics, will add that in a follow up pr as well.

@fredr fredr requested a review from eandre October 10, 2025 14:15
@fredr fredr self-assigned this Oct 10, 2025
Copy link

encore-cla bot commented Oct 10, 2025

All committers have signed the CLA.

@fredr
Copy link
Member Author

fredr commented Oct 16, 2025

actually, I will refactor this a bit since metrics-rs isn't flexible enough with the different types that we support. Drafting this for now

@fredr fredr marked this pull request as draft October 16, 2025 07:33
@fredr
Copy link
Member Author

fredr commented Oct 17, 2025

refactored and added system metrics to this ps

@fredr fredr marked this pull request as ready for review October 17, 2025 11:52
@fredr fredr changed the title runtimes/core: Add requests counter metric runtimes/core: Add metrics Oct 17, 2025
) -> Arc<dyn Exporter + Send + Sync> {
match self {
Self::Gcp(config) | Self::EncoreCloud(config) => {
runtime_handle.block_on(Self::create_gcp_exporter(config, env, http_client))
Copy link
Member

Choose a reason for hiding this comment

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

A bit annoying to need to block here. I guess the only reason we need to do that is because the container metadata needs to be collected? Can we do that lazily/in the background, similar to the lazy gcp client?

Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored to using a lazy cached client and avoiding the block_on by fetching the container data in the collect step

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.

2 participants