Skip to content

Add microservices development documentation#2700

Merged
jmthomas merged 2 commits intomainfrom
docs-2561-microservices-api
Jan 8, 2026
Merged

Add microservices development documentation#2700
jmthomas merged 2 commits intomainfrom
docs-2561-microservices-api

Conversation

@jmthomas
Copy link
Copy Markdown
Member

Summary

  • Adds new documentation for building custom microservices in COSMOS
  • Documents the APIs available to custom microservices and the development process
  • Placed in the Development section as requested in the issue

Key Documentation Sections

  • Creating microservices using the CLI generator
  • Microservice structure with full Ruby/Python templates
  • Plugin configuration keywords (CMD, ENV, PORT, TOPIC, etc.)
  • Available APIs with prominent API vs Script warning
  • Base class attributes (name, scope, state, count, logger, etc.)
  • Logging, state management, custom status (with polling notes)
  • Secrets access
  • HTTP endpoints (links to exposing-microservices guide)
  • Metrics tracking
  • Subscribing to Redis topics
  • Complete Safety Monitor example

Closes #2561

🤖 Generated with Claude Code

Document the APIs available to custom microservices and the development
process including:
- Creating microservices using the CLI generator
- Microservice structure and lifecycle
- Plugin configuration keywords
- Available APIs (with API vs Script warning)
- Base class attributes and methods
- Logging, state management, secrets, HTTP endpoints
- Note about frontend polling for state/custom status
- Subscribing to Redis topics
- Example safety monitor microservice

Closes #2561

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.24%. Comparing base (6f3cda6) to head (58a9734).
⚠️ Report is 47 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2700      +/-   ##
==========================================
- Coverage   79.31%   79.24%   -0.07%     
==========================================
  Files         662      664       +2     
  Lines       52588    52825     +237     
  Branches      734      734              
==========================================
+ Hits        41708    41862     +154     
- Misses      10800    10883      +83     
  Partials       80       80              
Flag Coverage Δ
python 81.16% <ø> (-0.23%) ⬇️
ruby-api 84.81% <ø> (+0.05%) ⬆️
ruby-backend 82.15% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

## Available APIs

:::warning API vs Script
When writing code for a microservice (or interface) that runs _within_ COSMOS, you must use the `openc3/api` library, **NOT** `openc3/script`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is a good callout here 👍

@logger.info("Info message")
@logger.warn("Warning message")
@logger.error("Error message")
@logger.fatal("Fatal message")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it could be worth mentioning the type: Logger::ALERT option you can pass in to bubble up to the notifications.


```ruby
@metric.set(name: 'requests_total', value: @count, type: 'counter')
@metric.set(name: 'processing_seconds', value: elapsed, type: 'gauge', unit: 'seconds')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We may want to provide additional info on what counter and gauge are?

- Add Alert Notifications section documenting Logger::ALERT type
  option for bubbling log messages to UI notifications
- Add Metric Types section explaining counter vs gauge metrics

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@jmthomas jmthomas requested a review from clayandgen January 8, 2026 16:42
Copy link
Copy Markdown
Contributor

@clayandgen clayandgen left a comment

Choose a reason for hiding this comment

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

Claude is a good technical writer 👍

@jmthomas jmthomas merged commit c95eade into main Jan 8, 2026
28 checks passed
@jmthomas jmthomas deleted the docs-2561-microservices-api branch January 8, 2026 17:36
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.

Document Microservices API and development

2 participants