cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Michael.Perlstein
AppDynamics Team (Retired)

1. Make commands generic

2. Make statement how any existing data in associated with the original field will be lost / needs transfer

 

 

After doing further research there does not appear to be a standard way of changing the data format associated with a field once it's created. There is available workaround which will remove the old field, add a new field with the correct data type, and then rename the new field to the original field name. Given you agree with ALL of the assumption below you should be able to follow these steps to achieve your updated field data format.

Assumptions: 
1. You have a schema named performancedetail
2. You have a field named old_name which is in integer format
3. There is no data associated with the field old_name 
4. You would like to change the data format for old_name​ from integer to float 

1. View Original Schema:

curl -s -XGET "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type: application/vnd.appd.events+json;v=2" -H"Accept: application/vnd.appd.events+json;v=2"

Response:

{
  "eventType": "performancedetail",
  "schema": {
    "eventTimestamp": "date",
    "pickupTimestamp": "date",
    "id": "integer",
    "old_name": "integer"
  }
}

2. Add New Field To Schema With Correct Data Type

curl -s -XPATCH "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type:application/vnd.appd.events+json;v=2" -H"Accept:application/vnd.appd.events+json;v=2" -d '[{ "add": { "new_name": "float" } }]'

3. View Updated Schema

curl -s -XGET "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type: application/vnd.appd.events+json;v=2" -H"Accept: application/vnd.appd.events+json;v=2"

  Response:

{
  "eventType": "performancedetail",
  "schema": {
    "eventTimestamp": "date",
    "pickupTimestamp": "date",
    "id": "integer",
    "old_name": "integer",
    "new_name": "float"    
  }
}

4. (Optional) Delete Old Field From Schema

curl -s -XPATCH "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type:application/vnd.appd.events+json;v=2" -H"Accept:application/vnd.appd.events+json;v=2" -d '[{ "delete": [ "old_name" ] }]'

5. (Optional) View Resulting Schema

curl -s -XGET "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type: application/vnd.appd.events+json;v=2" -H"Accept: application/vnd.appd.events+json;v=2"

  Response:

{
  "eventType": "performancedetail",
  "schema": {
    "eventTimestamp": "date",
    "pickupTimestamp": "date",
    "id": "integer",
    "new_name": "float"    
  }
}

6. (Optional) Rename New Field To The Original Field Name

curl -s -XPATCH "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type:application/vnd.appd.events+json;v=2" -H"Accept:application/vnd.appd.events+json;v=2" -d '[{ "rename": { "new_name": "old_name" } }]'

7. (Optional) View Final Schema

curl -s -XGET "http://svphxappdynprd02.hotelgroup.com:9080/events/schema/performancedetail" -H"X-Events-API-AccountName:customer1_197d3f0a-9a8d-4​0c4-a883-047266c8ae70" -H"X-Events-API-Key:d25c5243-1682-4434-b15b-5b7318a9c2d7" -H"Content-type: application/vnd.appd.events+json;v=2" -H"Accept: application/vnd.appd.events+json;v=2"

  Response:

{
  "eventType": "performancedetail",
  "schema": {
    "eventTimestamp": "date",
    "pickupTimestamp": "date",
    "id": "integer",
    "old_name": "float"    
  }
}

 _______________________________________________________________________________________

Was this helpful? Give it kudos [click on the thumbs up icon at the end of the article, bottom left corner] to let others know too!Was this helpful? Give it kudos [click on the thumbs up icon at the end of the article, bottom left corner] to let others know too!

Do you have a question or need clarification? [Post Your Comment] Below. 

Version history
Last update:
‎09-07-2018 11:10 AM
Updated by: