Skip to content

Conversation

Copy link

Copilot AI commented Nov 26, 2025

Description

Adds per-messenger configuration to control which record types are published. Previously all records were sent to all messengers. Now users can configure record_types per messenger section.

Default behavior:

  • SSM messengers (ssm, ssmv4): Only records from default extractors (cloud, ip, accelerator, storage)
  • Other messengers (noop, logstash): All record types

Configuration example:

[messenger_ssm]
record_types = cloud,storage

[messenger_logstash]
# Empty = all record types
record_types =

Changes:

  • caso/messenger/__init__.py: Added _filter_records(), get_messenger_opts(), register_messenger_opts(), and per-messenger filtering in Manager.push_to_all()
  • caso/opts.py: Added messenger-specific record_types options to list_opts()
  • etc/caso/caso.conf.sample: Regenerated sample configuration file with new messenger options using oslo-config-generator
  • doc/source/configuration.rst: Added documentation for messenger record type filtering, including a table mapping record types to extractors and example configurations
  • releasenotes/notes/messenger-record-type-filtering-*.yaml: Added release notes documenting the new feature and upgrade notes

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Added 22 new tests in caso/tests/test_messenger.py covering filtering logic, default configurations, and edge cases
  • All 72 tests pass
  • Verified sample configuration file generation via oslo-config-generator includes all [messenger_*] sections with record_types option

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
Original prompt

Implement mapping configuration between record types and messengers


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 26, 2025
Copilot AI and others added 2 commits November 26, 2025 18:50
Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
…ering

Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mapping configuration for record types and messengers feat: implement mapping configuration between record types and messengers Nov 26, 2025
Copilot finished work on behalf of alvarolopez November 26, 2025 18:55
Copilot AI requested a review from alvarolopez November 26, 2025 18:55
@alvarolopez
Copy link
Member

@copilot Will this setup generate the correct sample configuration file? Taking into account that you are registering the options in the manager, when generating the options via oslo, these will not be set.

Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 26, 2025

@copilot Will this setup generate the correct sample configuration file? Taking into account that you are registering the options in the manager, when generating the options via oslo, these will not b...

Yes, the sample configuration file is correctly generated. The options are defined in opts.py via list_opts() which iterates through all available messengers and returns their record_types options. This is independent of the runtime registration in Manager.__init__(). I've regenerated the sample config file (87b6768) which now includes all [messenger_*] sections with the record_types option.

Copilot finished work on behalf of alvarolopez November 26, 2025 19:06
@alvarolopez
Copy link
Member

@copilot There are two more things missing:

  • We need to add documentation for this change.
  • The prometheus extractor is not included in the config file.

Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 26, 2025

@copilot There are two more things missing:

  • We need to add documentation for this change.
  • The prometheus extractor is not included in the config file.

Added documentation for messenger record type filtering in doc/source/configuration.rst (4741c66). The docs include a table mapping record types to extractors and explains that energy records from the prometheus extractor are not published to SSM by default. Users can enable energy records for SSM by explicitly adding energy to the record_types list in [messenger_ssm].

Copilot finished work on behalf of alvarolopez November 26, 2025 19:20
@alvarolopez
Copy link
Member

@copilot caso/messenger/init.py:152 make those lines simpler:

    for messenger_name in CONF.messengers:
        group_name = f"messenger_{messenger_name}"
        if hasattr(CONF, group_name):
            group = getattr(CONF, group_name)
            if hasattr(group, "record_types"):
                record_types = group.record_types
                if record_types:
                    self.messenger_record_types[messenger_name] = list(record_types)

Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 26, 2025

@copilot caso/messenger/init.py:152 make those lines simpler:

    for messenger_name in CONF.messengers:...

Simplified the loop as suggested in 20d3dcb. Now sets None as default first and only updates if record_types are present.

Copilot finished work on behalf of alvarolopez November 26, 2025 22:05
@alvarolopez alvarolopez requested a review from jaimeib November 26, 2025 22:06
@alvarolopez
Copy link
Member

@copilot please include a release notes file, documenting this new behaviour. Although this does not change the behaviour (as we have the defaults) this should be documented.

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 37.50000% with 30 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@741c448). Learn more about missing BASE report.

Files with missing lines Patch % Lines
caso/messenger/__init__.py 43.90% 23 Missing ⚠️
caso/opts.py 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #161   +/-   ##
=========================================
  Coverage          ?   60.68%           
=========================================
  Files             ?       24           
  Lines             ?     1343           
  Branches          ?      129           
=========================================
  Hits              ?      815           
  Misses            ?      505           
  Partials          ?       23           

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

Co-authored-by: alvarolopez <468751+alvarolopez@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 26, 2025

@copilot please include a release notes file, documenting this new behaviour. Although this does not change the behaviour (as we have the defaults) this should be documented.

Added release notes in 035010c. The file documents the new features (per-messenger record type filtering, default behaviors for SSM and other messengers) and includes upgrade notes explaining how to enable energy records for SSM.

@sonarqubecloud
Copy link

Copilot finished work on behalf of alvarolopez November 26, 2025 22:11
@alvarolopez alvarolopez marked this pull request as ready for review November 26, 2025 22:30
@sonarqubecloud
Copy link

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