Skip to content

Publish a JSON schema of the config #1219

Open

Description

@jedwards1211

Having a JSON schema for the config format would be a lot more convenient than the current format of the docs: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html

It would have the following advantages:

  1. Probably easier to read than the docs IMO
  2. It's a better specified and completely unambiguous documentation format
  3. If we're generating config with our own code we could validate that it's correct before passing it to CloudWatch Agent
  4. We could generate TypeScript types etc. from a JSON schema

Activity

  1. okankoAMZ commented on Jul 18, 2024

    @okankoAMZ
    Contributor

    Hi!

    If I understand correctly, you want to add a rule schema to our JSON configurations to make config generation easier? If you would like I can create a feature request for that.

    Please let me know if you have any other questions

  2. jedwards1211 commented on Jul 18, 2024

    @jedwards1211
    Author

    I'm not sure what you mean by rule schema, I'm asking you to make a JSON Schema document available at some URL under AWS that specifies the schema of the JSON cloudwatch agent config. And anytime the config format is extended/changed, make a new JSON Schema for it available under a new URL containing a config version number of some kind.

  3. jedwards1211 commented on Jul 18, 2024

    @jedwards1211
    Author

    So to be clear something like GET https://docs.aws.amazon.com/AmazonCloudWatch/config-schema/<version>/schema.json responds with Content-Type: application/json and body (incomplete example):

    {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://docs.aws.amazon.com/AmazonCloudWatch/config-schema/latest/schema.json",
      "type": "object",
      "properties": {
         "agent": {
           "type": "object",
           "properties": {
             "metrics_collection_interval": {"type": "number"},
           },
           "additionalProperties": false
         }
       },
      "additionalProperties": false
    }

    And then links to these URLs in the documentation pages.

  4. okankoAMZ commented on Jul 18, 2024

    @okankoAMZ
    Contributor

    I see , so you want us to have our schema.json found here to be in our documentation?

  5. jedwards1211 commented on Jul 18, 2024

    @jedwards1211
    Author

    Oh, sorry I wasn't aware of the existence of that. I tend to be rushing to get deployments working and I missed the mention of that in the docs.

  6. jedwards1211 commented on Jul 18, 2024

    @jedwards1211
    Author

    Oh wait. The docs at https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html only say:

    The following sections explain the structure and fields of this JSON file. You can also view the schema definition for this configuration file. The schema definition is located at installation-directory/doc/amazon-cloudwatch-agent-schema.json on Linux servers, and at installation-directory/amazon-cloudwatch-agent-schema.json on servers running Windows Server.

    That's why I wasn't aware of the schema in this repo.

    It would have helped me if there were a link in that page to https://github.com/aws/amazon-cloudwatch-agent/blob/main/translator/config/schema.json so that I could view it without going into an instance with CloudWatch agent installed.

  7. okankoAMZ commented on Jul 19, 2024

    @okankoAMZ
    Contributor

    I understand, I will create an action item in our backlog to consider this change. Thank you for bringing this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions