Skip to content

Fix metric types enforcement: Implement proper OpenTelemetry type handling v0.1.02#27

Merged
laplaque merged 1 commit intomasterfrom
fix/metric-types-enforcement-all-plugins-v0.1.02
Jun 23, 2025
Merged

Fix metric types enforcement: Implement proper OpenTelemetry type handling v0.1.02#27
laplaque merged 1 commit intomasterfrom
fix/metric-types-enforcement-all-plugins-v0.1.02

Conversation

@laplaque
Copy link
Copy Markdown
Owner

Description

Fix critical issue where all metrics appeared as GAUGE in Instana despite manifest.toml configuration specifying different OpenTelemetry types. This implementation ensures proper type enforcement (Gauge, Counter, UpDownCounter) and strict TOML compliance.

Key Changes:

  • Fixed OpenTelemetry Type Handling: Added unified create_observable() method respecting otel_type from manifest.toml
  • Database-Driven Architecture: Implemented 'register once, read many' pattern with TOML sync to persistent database
  • Strict TOML Compliance: Only metrics defined in manifest.toml are accepted, rejects undefined metrics
  • Enhanced Metadata Store: Added schema v2.0 with otel_type column and missing methods
  • Updated Documentation: Comprehensive v0.1.02 release notes and RELEASE_NOTES.md updates

Verification Results:

✅ Successfully synced TOML metrics to database
✅ Loaded 20 metrics from database registry
✅ Registered 20 observable metrics from database
✅ Proper rejection of undefined metrics with warnings

Impact:

Affects all Strategy₿ plugins: m8mulprc, m8prcsvr, m8refsvr, mstrsvr

Checklist before requesting a review

  • I have performed a self-review of my code
  • If this is a merge to master, I will create a version tag (v*..)
  • The version tag will be higher than the previous version

Tag Information

Planned tag: v0.1.02

Copilot AI review requested due to automatic review settings June 23, 2025 14:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a critical bug in metric type enforcement by implementing proper OpenTelemetry type handling with strict TOML compliance and a database-driven metric registry. Key changes include a unified create_observable() method, syncing TOML definitions to a persistent database, and enhanced testing and documentation updates.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_otel_connector.py Updated tests to validate the rejection of undefined metrics and proper conversion of numeric strings.
docs/releases/TAG_v0.1.02.md Updated release documentation to reflect new architecture and metric type enforcement.
docs/releases/RELEASE_NOTES.md Expanded release notes outlining the bug fix and architectural improvements.
common/otel_connector.py Refactored to introduce unified metric creation and database-driven observable metrics registration.
common/metadata_store.py Added methods to sync TOML definitions and manage obsolete metrics in the database.
common/manifest.toml Bumped version to 0.1.02 reflecting metric type enforcement changes.

…dling v0.1.02

- Fix critical issue where all metrics appeared as GAUGE in Instana
- Add unified create_observable() method respecting TOML otel_type config
- Implement 'register once, read many' architecture with database sync
- Remove dynamic metric registration for strict TOML compliance
- Support proper Gauge/Counter/UpDownCounter types from manifest.toml
- Add missing MetadataStore methods: sync_metric_from_toml, get_service_metrics
- Update RELEASE_NOTES.md with comprehensive v0.1.02 documentation
- Update test_otel_connector.py to test new architecture and unified methods
- Fix string number conversion: Replace isdigit() with try/except float()
- Now handles both integer strings ('85') and decimal strings ('10.5')
- Version bump to v0.1.02

VERIFIED WORKING:
- TOML sync to database: 'Successfully synced TOML metrics to database'
- Database metric loading: 'Loaded 20 metrics from database registry'
- Proper metric registration: 'Registered 20 observable metrics from database'
- Strict validation: Rejects undefined metrics with proper warnings
- String conversion: Handles '10.5' and '85' correctly

Addresses Copilot feedback from PR #27
Affects all Strategy₿ plugins: m8mulprc, m8prcsvr, m8refsvr, mstrsvr
@laplaque laplaque force-pushed the fix/metric-types-enforcement-all-plugins-v0.1.02 branch from e1885f2 to 865e90f Compare June 23, 2025 14:18
@laplaque laplaque merged commit 4ae628f into master Jun 23, 2025
4 checks passed
@laplaque laplaque deleted the fix/metric-types-enforcement-all-plugins-v0.1.02 branch June 23, 2025 14:22
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