Skip to content

Comments

Remove observabilityEnabled check to include icp.runtimeId#1446

Merged
daneshk merged 2 commits intoballerina-platform:masterfrom
NipunaMadhushan:fix-icp-tag
Feb 12, 2026
Merged

Remove observabilityEnabled check to include icp.runtimeId#1446
daneshk merged 2 commits intoballerina-platform:masterfrom
NipunaMadhushan:fix-icp-tag

Conversation

@NipunaMadhushan
Copy link
Contributor

@NipunaMadhushan NipunaMadhushan commented Feb 11, 2026

Purpose

ICP runtimeId should print even if any observability provider is not set. Otherwise we cannot filter runtime logs on ICP.

Fixes ballerina-platform/ballerina-library#8648

Examples

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

Summary

This pull request modifies the logging behavior to ensure that the ICP runtimeId is consistently included in application logs, regardless of whether an observability provider is configured. The change removes a conditional check that previously guarded the runtimeId extraction, allowing the runtime identifier to be captured and added to log records unconditionally whenever available. This improvement enables developers to filter and trace runtime logs using the runtimeId identifier, enhancing log filtering and application troubleshooting capabilities.

Changes Made

  • Modified ballerina/root_logger.bal to unconditionally retrieve and include the ICP runtimeId in log records, independent of observability provider configuration status.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

The change removes the observability provider check guarding ICP runtime ID retrieval in the root logger. The runtime ID is now unconditionally extracted and included in log records when available, ensuring it appears in logs regardless of observability configuration.

Changes

Cohort / File(s) Summary
Root Logger Configuration
ballerina/root_logger.bal
Unconditionally retrieves and assigns ICP_RUNTIME_ID_KEY to log records, independent of observability provider enablement state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • #8648: Directly addresses the issue where ICP runtime ID was not included in logs when no observability provider was configured; removing the observability enabled guard ensures ICP_RUNTIME_ID_KEY is always populated when available.

Poem

🐰 A hop, a skip, through logs so bright,
Runtime IDs now always in sight,
No guards to block the rabbit's delight,
Observability need not be tight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: removing the observabilityEnabled check to include the icp.runtimeId field.
Description check ✅ Passed The PR description follows the template structure with Purpose section, Examples section, and Checklist. All required sections are present and the description is mostly complete.
Linked Issues check ✅ Passed The PR addresses issue #8648 by unconditionally retrieving and including the icp.runtimeId tag in log records regardless of observability provider configuration, which directly fixes the reported bug.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to the root_logger.bal file, removing the observabilityEnabled guard around runtimeId retrieval, which directly addresses the linked issue requirement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.22%. Comparing base (45abd09) to head (51c5b8e).
⚠️ Report is 4 commits behind head on master.

❌ Your project status has failed because the head coverage (78.22%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1446   +/-   ##
=========================================
  Coverage     78.22%   78.22%           
  Complexity       97       97           
=========================================
  Files             9        9           
  Lines           620      620           
  Branches        116      116           
=========================================
  Hits            485      485           
  Misses          100      100           
  Partials         35       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

if runtimeId is string {
logRecord[ICP_RUNTIME_ID_KEY] = runtimeId;
}
string? runtimeId = observe:getTagValue(ICP_RUNTIME_ID_KEY);
Copy link
Contributor

Choose a reason for hiding this comment

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

Without observability enabled, do we get this tag value? If so why the tag is exposed in observe API instead of a runtime API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is that isObservabilityEnabled() check becomes true only if any observability provider is set. Otherwise, it remains false even if we have enabled observability in Ballerina.toml

@daneshk daneshk merged commit f8beeaa into ballerina-platform:master Feb 12, 2026
8 of 9 checks passed
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.

ICP runtime id is not included in the logs when any observability provider is not set

4 participants