Skip to content

Old version upgrade steps #10

@satomic

Description

@satomic

How to know the version?

The version is defined in the docker container, you can use this command

docker exec -it cpuad cat version

# this is the output
20250404

Old version (<=20250220) upgrade steps

Prerequest

Steps

1. Update index copilot_usage_breakdown

check its current status

curl localhost:9200/copilot_usage_breakdown/_mapping?pretty

if it does not have the model field, that means the version is too old. update with command, then check it again.

curl -X PUT "http://localhost:9200/copilot_usage_breakdown/_mapping" \
     -H 'Content-Type: application/json' \
     -d '{
       "properties": {
         "model": {
           "type": "keyword"
         }
       }
     }'

2. Update copilot_usage_breakdown historical data

Add value default to the model field added to the historical data

curl -X POST "http://localhost:9200/copilot_usage_breakdown/_update_by_query?conflicts=proceed" \
     -H "Content-Type: application/json" \
     -d '{
       "script": {
         "source": "if (ctx._source.model == null) { ctx._source.model = params.defaultValue }",
         "params": {
           "defaultValue": "default"
         }
       }
     }'

3. Update index copilot_usage_total

check its current status

curl localhost:9200/copilot_usage_total/_mapping?pretty

if it does not have the total_chat_copy_events & total_chat_insertion_events field, that means the version is too old. update with command, then check it again.

curl -X PUT "http://localhost:9200/copilot_usage_total/_mapping" \
     -H 'Content-Type: application/json' \
     -d '{
       "properties": {
         "total_chat_copy_events" : {
         "type" : "long"
         },
         "total_chat_insertion_events" : {
         "type" : "long"
         }
       }
     }'

4. Create new index copilot_usage_breakdown_chat

curl -X PUT "http://localhost:9200/copilot_usage_breakdown_chat" -H 'Content-Type: application/json' -d @mapping/copilot_usage_breakdown_chat_mapping.json

5. Create a new data source in Grafana

  • Access Grafana in the browser and create a new data source: elasticsearch-breakdown-chat
  • Image

6. Generate Dashboard Json

Generate Dashboard Json Model again, and import to the Grafana.

7. Run the latest CPUAD image

docker pull satomic/cpuad-updater:20250222

and run it again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions