A Prometheus target's token_from names the plugin that supplies its token at each scrape. Read its metrics makes the target; Use this sign-in moves one at that address across, keeping its name, filters and history. A refusal stops the connection, so one Try again or sign-in starts everything, and the sign-in is only sent to its own address. A 404 says how to turn on Home Assistant's Prometheus integration, as Steward doesn't change Home Assistant. Refused also joins the volatile columns a backup check ignores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
655 B
Python
24 lines
655 B
Python
"""A target can take its token from another plugin's sign-in
|
|
|
|
Revision ID: prometheus_004_token_from
|
|
Revises: prometheus_003_refused
|
|
Create Date: 2026-11-01
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "prometheus_004_token_from"
|
|
down_revision: Union[str, None] = "prometheus_003_refused"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("prometheus_targets", sa.Column("token_from", sa.String(50), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("prometheus_targets", "token_from")
|