Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish a JSON schema of the config #1219

Open
jedwards1211 opened this issue Jun 18, 2024 · 7 comments
Open

Publish a JSON schema of the config #1219

jedwards1211 opened this issue Jun 18, 2024 · 7 comments
Labels
area/documentation Improvements or additions to documentation status/backlog Backlog

Comments

@jedwards1211
Copy link

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
@okankoAMZ
Copy link
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

@okankoAMZ okankoAMZ added the area/documentation Improvements or additions to documentation label Jul 18, 2024
@jedwards1211
Copy link
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.

@jedwards1211
Copy link
Author

jedwards1211 commented Jul 18, 2024

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.

@okankoAMZ
Copy link
Contributor

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

@jedwards1211
Copy link
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.

@jedwards1211
Copy link
Author

jedwards1211 commented Jul 18, 2024

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.

@jedwards1211 jedwards1211 reopened this Jul 18, 2024
@okankoAMZ
Copy link
Contributor

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

@okankoAMZ okankoAMZ added the status/backlog Backlog label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation status/backlog Backlog
Projects
None yet
Development

No branches or pull requests

2 participants