conf:
  ceilometer:
    DEFAULT:
      debug: "true"
      event_dispatchers:
        type: multistring
        values:
          - gnocchi
      meter_dispatchers:
        type: multistring
        values:
          - gnocchi
    api:
      aodh_url: "NotUsed"
    database:
      connection: "NotUsed"
      event_connection: "NotUsed"
      metering_connection: "NotUsed"
      connection_debug: 0
      connection_recycle_time: 600
      connection_trace: true
      idle_timeout: 3600
      mysql_sql_mode: {}
      use_db_reconnect: true
      pool_timeout: 60
      max_retries: -1
    notification:
      messaging_urls:
        type: multistring
        values:
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/ceilometer
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/cinder
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/glance
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/nova
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/keystone
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/neutron
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/heat
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/swift
          - rabbit://rabbitmq:password@rabbitmq.openstack.svc.cluster.local:5672/blazar
    oslo_messaging_notifications:
      driver: messagingv2
      topics:
        - notifications
        - profiler
    oslo_concurrency:
      lock_path: /tmp/ceilometer
    oslo_messaging_rabbit:
      amqp_durable_queues: false
      rabbit_ha_queues: false
      rabbit_quorum_queue: true
      rabbit_transient_quorum_queue: false
      use_queue_manager: false
      rabbit_interval_max: 10
      # Send more frequent heartbeats and fail unhealthy nodes faster
      # heartbeat_timeout / heartbeat_rate / 2.0 = 30 / 3 / 2.0 = 5
      heartbeat_rate: 3
      heartbeat_timeout_threshold: 60
      # DEPRECIATION:  (warning) heartbeat_in_pthread will be deprecated in 2024.2
      heartbeat_in_pthread: true
      # Setting lower kombu_reconnect_delay should resolve issue with HA failing when one node is down
      # https://lists.openstack.org/pipermail/openstack-discuss/2023-April/033314.html
      # https://review.opendev.org/c/openstack/oslo.messaging/+/866617
      kombu_reconnect_delay: 0.5

  event_definitions:
    # Blazar events and metrics
    - event_type:
        - "start_lease"
        - "end_lease"
        - "before_end_lease"
        - "lease.create"
        - "lease.update"
        - "lease.delete"
        - "lease.start"
        - "lease.end"
        - "lease.event.start_lease"
        - "lease.event.end_lease"
        - "lease.event.before_end_lease"
      traits: &reservation_traits
        # Lease identification
        lease_id:
          fields:
            - payload.lease_id
        name:
          fields:
            - payload.name
        project_id:
          fields:
            - payload.project_id
        user_id:
          fields:
            - payload.user_id
        trust_id:
          fields:
            - payload.trust_id

        # Lease timing
        start_date:
          fields:
            - payload.start_date
        end_date:
          fields:
            - payload.end_date
        created_at:
          fields:
            - payload.created_at
        updated_at:
          fields:
            - payload.updated_at

        # Lease status
        status:
          fields:
            - payload.status
        degraded:
          fields:
            - payload.degraded

        # Reservation details - common fields
        resource_id:
          fields:
            - payload.reservations.resource_id
        # Virtual instance & Flavor instance reservation attributes
        vcpus:
          fields:
            - payload.reservations.vcpus

        # Physical host reservation attributes
        min:
          fields:
            - payload.reservations.min
        max:
          fields:
            - payload.reservations[0].max
#            - payload.reservations[?(@.resource_type='physical:host')].max

  gnocchi_resources:
    archive_policy_default: ceilometer-low
    archive_policies:
      # NOTE(sileht): We keep "mean" for now to not break all gating that
      # use the current tempest scenario.
      - name: ceilometer-low
        aggregation_methods:
          - mean
        back_window: 0
        definition:
          - granularity: 5 minutes
            timespan: 30 days
      - name: ceilometer-low-rate
        aggregation_methods:
          - mean
          - rate:mean
        back_window: 0
        definition:
          - granularity: 5 minutes
            timespan: 30 days
      - name: ceilometer-high
        aggregation_methods:
          - mean
        back_window: 0
        definition:
          - granularity: 1 second
            timespan: 1 hour
          - granularity: 1 minute
            timespan: 1 day
          - granularity: 1 hour
            timespan: 365 days
      - name: ceilometer-high-rate
        aggregation_methods:
          - mean
          - rate:mean
        back_window: 0
        definition:
          - granularity: 1 second
            timespan: 1 hour
          - granularity: 1 minute
            timespan: 1 day
          - granularity: 1 hour
            timespan: 365 days
    resources:
      - resource_type: reservation
        metrics:
          # Lease lifecycle events (time-series)
          - "blazar.lease.create"
          - "blazar.lease.start"
          - "blazar.lease.before_end"
          - "blazar.lease.end"
          - "blazar.lease.delete"
        attributes:
          name: resource_metadata.name
          status: resource_metadata.status
          start_date: resource_metadata.start_date
          end_date: resource_metadata.end_date
        event_create:
          - start_lease
          - lease.event.start_lease
          - lease.create
          - lease.start
        event_update:
          - lease.event.before_end_lease
          - lease.event.start_lease
          - lease.event.end_lease
          - before_end_lease
          - start_lease
          - end_lease
          - lease.start
          - lease.end
          - lease.update
        event_delete:
          - lease.delete
        event_attributes:
          id: lease_id
          name: name
          start_date: start_date
          end_date: end_date
          status: status


  meters:
    metric:
      # Blazar lease lifecycle and reservation metrics
      - name: "blazar.lease.create"
        event_type:
          - "lease.create"
        type: "delta"
        unit: "lease"
        volume: 1
        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date

      - name: "blazar.lease.start"
        event_type:
          - "lease.event.start_lease"
          - "lease.start"
          - "start_lease"
        type: "delta"
        unit: "lease"
        volume: 1
        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date

      - name: "blazar.lease.before_end"
        event_type:
          - "lease.event.before_end_lease"
          - "before_end_lease"
        type: "delta"
        unit: "lease"
        volume: 1
        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date

      - name: "blazar.lease.end"
        event_type:
          - "lease.event.end_lease"
          - "lease.end"
          - "end_lease"
        type: "delta"
        unit: "lease"
        volume: 1
        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date

      - name: "blazar.lease.delete"
        event_type:
          - "lease.delete"
          - "lease.event.delete"
        type: "delta"
        unit: "lease"
        volume: 1
        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date

      # Virtual Host Reservation Metrics
      - name: "blazar.reservation.instance.vcpus"
#      - name: $.payload.reservations.[*].resource_id + "_" + "blazar.reservation.instance.vcpus"
        event_type:
          - "lease.create"
          - "lease.event.start_lease"
          - "lease.start"
          - "start_lease"
        type: "gauge"
        unit: "vcpus"
        volume: $.payload.reservations.[*].vcpus
#        volume: $.payload.reservations[?resource_type='virtual:instance'].vcpus
        resource_id: $.payload.reservations.[*].resource_id
#        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date
        lookup:
#          - "name"
#          - "unit"
          - "volume"
          - "resource_id"

      # Physical Host Reservation Metrics
      - name: "blazar.reservation.host.max"
      - name: $.payload.reservations.[*].id + "_blazar_max"
        event_type:
          - "lease.create"
          - "lease.event.start_lease"
          - "lease.start"
          - "start_lease"
        type: "gauge"
        unit: "host"
        volume: $.payload.reservations.[*].max
#        volume: $.payload.reservations[?(@.resource_type='physical:host')].max
        resource_id: $.payload.reservations.[*].resource_id
#        resource_id: $.payload.lease_id
        project_id: $.payload.project_id
        user_id: $.payload.user_id
        metadata:
          name: $.payload.name
          status: $.payload.status
          start_date: $.payload.start_date
          end_date: $.payload.end_date
        lookup:
#          - "name"
#          - "unit"
          - "volume"
          - "resource_id"

  polling:
    sources:
      - name: all_pollsters
        interval: 300
        meters:
          - "*"
  pipeline:
    sources:
      - name: meter_source
        meters:
          - "*"
        sinks:
          - meter_sink
      - name: blazar_source
        channels:
          - blazar
        meters:
          - "*"
        events:
          - lease.event.start_lease
          - lease.event.end_lease
          - lease.event.before_end_lease
          - lease.*
        sinks:
          - blazar_sink
    sinks:
      - name: meter_sink
        publishers:
          - gnocchi
      - name: blazar_sink
        publishers:
          - gnocchi
    channels:
      - name: blazar
        sources:
        - blazar_source
  event_pipeline:
    sinks:
      - name: event_sink
        publishers:
          - gnocchi://
    sources:
      - events:
          - "*"
        name: event_source
        sinks:
          - event_sink
dependencies:
  static:
    central:
      jobs:
        - ceilometer-db-sync
        - ceilometer-ks-user
      services:
        - endpoint: internal
          service: identity
        - endpoint: internal
          service: metric
    ipmi:
      jobs:
        - ceilometer-db-sync
        - ceilometer-ks-user
      services:
        - endpoint: internal
          service: identity
        - endpoint: internal
          service: metric
    compute:
      jobs:
        - ceilometer-db-sync
        - ceilometer-ks-user
      services:
        - endpoint: internal
          service: identity
        - endpoint: internal
          service: metric
    db_sync:
      jobs: []
      services: []
    notification:
      jobs:
        - ceilometer-db-sync
        - ceilometer-ks-user
      services:
        - endpoint: internal
          service: identity
        - endpoint: internal
          service: metric

# typically overridden by environmental
# values, but should include all endpoints
# required by this chart
endpoints:
  metering:
    port:
      api:
        default: 5000
        public: 80
        internal: 5000
        service: 5000
  metric:
    port:
      api:
        default: 8041
        public: 80
        internal: 8041
        service: 8041
  oslo_messaging:
    host_fqdn_override:
      default: rabbitmq.openstack.svc.cluster.local

manifests:
  deployment_api: false
  deployment_collector: false
  ingress_api: false
  # using gnocchi so no db init
  job_rabbit_init: false
  job_db_init: false
  job_db_init_mongodb: false
  job_ks_endpoints: false
  job_ks_service: false
  secret_mongodb: false
  service_ingress_api: false