-
Notifications
You must be signed in to change notification settings - Fork 556
[AWS] Add API Gateway metrics data stream #6188
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
Merged
lucian-ioan
merged 24 commits into
elastic:main
from
lucian-ioan:add_aws-apigateway_metrics
Jun 5, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c134653
Add sample event
77400c6
Add changelog entry
6f2115e
Add stream
42cf949
Add manifest
585d39d
Add fields
b23aa9d
Add manifest entry
8bf1148
Fix fields
fefed56
Merge remote-tracking branch 'upstream/main' into add_aws-apigateway_…
ca29ca1
Add icon
baca46b
Update descriptions
41bddcc
Update package-fields description
lucian-ioan 51571d1
Add unit and metric types
5600cb1
Add docs
552cf26
Update packages/aws/_dev/build/docs/apigateway.md
lucian-ioan ecc40af
Update packages/aws/docs/apigateway.md
lucian-ioan 0f90421
Update packages/aws/manifest.yml
lucian-ioan 7d03282
Update packages/aws/docs/apigateway.md
lucian-ioan b867a42
Update packages/aws/manifest.yml
lucian-ioan 18855ca
Update packages/aws/_dev/build/docs/apigateway.md
lucian-ioan 9bd25c0
Update packages/aws/data_stream/apigateway_metrics/manifest.yml
lucian-ioan 587c085
Merge remote-tracking branch 'upstream/main' into add_aws-apigateway_…
4bf2620
fix apigateway docs
321d0aa
Merge branch 'main' into add_aws-apigateway_metrics
lucian-ioan 2793d6d
Merge branch 'main' into add_aws-apigateway_metrics
lucian-ioan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # AWS API Gateway | ||
|
|
||
| The AWS API Gateway integration allows you to monitor [API Gateway](https://aws.amazon.com/api-gateway/) — a centralized API management service. | ||
|
|
||
| Use the AWS API Gateway integration to collect metrics related to your HTTP, REST or WebSockets APIs. Then visualize that data in Kibana, create alerts to notify you if something goes wrong, and reference metrics when troubleshooting an issue. | ||
|
|
||
| For example, you could use this integration to examine metrics related to error rates, response codes, and latency. You can pinpoint problematic areas, identify error-prone API endpoints, and troubleshoot performance issues. | ||
|
|
||
| **IMPORTANT: Extra AWS charges on AWS API requests will be generated by this integration. Please refer to the AWS integration for more details.** | ||
|
|
||
| ## Data streams | ||
|
|
||
| The API Gateway integration collects one type of data: metrics. | ||
|
|
||
| **Metrics** give you insight into the state of API Gateway. | ||
| Metrics collected by the AWS API Gateway integration include the number of client and server errors, request and error counts and cache counts. | ||
|
|
||
| See more details in the [Metrics reference](#metrics-reference). | ||
|
|
||
| ## Requirements | ||
|
|
||
| You need Elasticsearch for storing and searching your data and Kibana for visualizing and managing it. | ||
| You can use our hosted Elasticsearch Service on Elastic Cloud, which is recommended, or self-manage the Elastic Stack on your hardware. | ||
|
|
||
| Before using any AWS integration you will need: | ||
|
|
||
| * **AWS Credentials** to connect with your AWS account. | ||
| * **AWS Permissions** to make sure the user you're using to connect has permission to share the relevant data. | ||
|
|
||
| For more details about these requirements, please take a look at the **AWS** integration documentation. | ||
|
|
||
| ## Setup | ||
|
|
||
| Use this integration if you only need to collect data from the AWS API Gateway service. | ||
|
|
||
| If you want to collect data from two or more AWS services, consider using the **AWS** integration. | ||
| When you configure the AWS integration, you can collect data from as many AWS services as you'd like. | ||
|
|
||
| For step-by-step instructions on how to set up an integration, see the | ||
| {{ url "getting-started-observability" "Getting started" }} guide. | ||
|
|
||
| ## Metrics reference | ||
|
|
||
| {{event "apigateway_metrics"}} | ||
|
|
||
| {{fields "apigateway_metrics"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/aws/data_stream/apigateway_metrics/agent/stream/stream.yml.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| metricsets: ["cloudwatch"] | ||
| period: {{period}} | ||
| {{#if data_granularity}} | ||
| data_granularity: {{data_granularity}} | ||
| {{/if}} | ||
| {{#if access_key_id}} | ||
| access_key_id: {{access_key_id}} | ||
| {{/if}} | ||
| {{#if secret_access_key}} | ||
| secret_access_key: {{secret_access_key}} | ||
| {{/if}} | ||
| {{#if session_token}} | ||
| session_token: {{session_token}} | ||
| {{/if}} | ||
| {{#if credential_profile_name}} | ||
| credential_profile_name: {{credential_profile_name}} | ||
| {{/if}} | ||
| {{#if shared_credential_file}} | ||
| shared_credential_file: {{shared_credential_file}} | ||
| {{/if}} | ||
| {{#if role_arn}} | ||
| role_arn: {{role_arn}} | ||
| {{/if}} | ||
| {{#if default_region}} | ||
| default_region: {{default_region}} | ||
| {{/if}} | ||
| {{#if regions}} | ||
| regions: | ||
| {{#each regions as |region i|}} | ||
| - {{region}} | ||
| {{/each}} | ||
| {{/if}} | ||
| {{#if latency}} | ||
| latency: {{latency}} | ||
| {{/if}} | ||
| {{#if tags_filter}} | ||
| tags_filter: {{tags_filter}} | ||
| {{/if}} | ||
| {{#if proxy_url }} | ||
| proxy_url: {{proxy_url}} | ||
| {{/if}} | ||
| metrics: | ||
| - namespace: AWS/ApiGateway | ||
| statistic: ["Sum"] | ||
| name: | ||
| - 4XXError | ||
| - 4xx | ||
| - 5XXError | ||
| - 5xx | ||
| - CacheHitCount | ||
| - CacheMissCount | ||
| - Count | ||
| - ConnectCount | ||
| - MessageCount | ||
| - IntegrationError | ||
| - ClientError | ||
| - ExecutionError | ||
| - namespace: AWS/ApiGateway | ||
| statistic: ["Average"] | ||
| name: | ||
| - Latency | ||
| - IntegrationLatency | ||
| - DataProcessed | ||
35 changes: 35 additions & 0 deletions
35
packages/aws/data_stream/apigateway_metrics/fields/agent.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| - name: cloud | ||
| title: Cloud | ||
| group: 2 | ||
| description: Fields related to the cloud or infrastructure the events are coming from. | ||
| footnote: 'Examples: If Metricbeat is running on an EC2 host and fetches data from its host, the cloud info contains the data about this machine. If Metricbeat runs on a remote machine outside the cloud and fetches data from a service running in the cloud, the field contains cloud data from the machine the service is running on.' | ||
| type: group | ||
| fields: | ||
| - name: image.id | ||
| type: keyword | ||
| description: Image ID for the cloud instance. | ||
| - name: host | ||
| title: Host | ||
| group: 2 | ||
| description: 'A host is defined as a general computing instance. | ||
|
|
||
| ECS host.* fields should be populated with details about the host on which the event happened, or from which the measurement was taken. Host types include hardware, virtual machines, Docker containers, and Kubernetes nodes.' | ||
| type: group | ||
| fields: | ||
| - name: containerized | ||
| type: boolean | ||
| description: > | ||
| If the host is a container. | ||
|
|
||
| - name: os.build | ||
| type: keyword | ||
| example: "18D109" | ||
| description: > | ||
| OS build information. | ||
|
|
||
| - name: os.codename | ||
| type: keyword | ||
| example: "stretch" | ||
| description: > | ||
| OS codename, if any. | ||
|
|
20 changes: 20 additions & 0 deletions
20
packages/aws/data_stream/apigateway_metrics/fields/base-fields.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| - name: data_stream.type | ||
| type: constant_keyword | ||
| description: Data stream type. | ||
| - name: data_stream.dataset | ||
| type: constant_keyword | ||
| description: Data stream dataset. | ||
| - name: data_stream.namespace | ||
| type: constant_keyword | ||
| description: Data stream namespace. | ||
| - name: '@timestamp' | ||
| type: date | ||
| description: Event timestamp. | ||
| - name: event.module | ||
| type: constant_keyword | ||
| description: Event module | ||
| value: aws | ||
| - name: event.dataset | ||
| type: constant_keyword | ||
| description: Event dataset | ||
| value: aws.apigateway_metrics |
62 changes: 62 additions & 0 deletions
62
packages/aws/data_stream/apigateway_metrics/fields/ecs.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| - external: ecs | ||
| name: cloud | ||
| - external: ecs | ||
| name: cloud.account.id | ||
| - external: ecs | ||
| name: cloud.account.name | ||
| - external: ecs | ||
| name: cloud.availability_zone | ||
| - external: ecs | ||
| name: cloud.instance.id | ||
| - external: ecs | ||
| name: cloud.machine.type | ||
| - external: ecs | ||
| name: cloud.provider | ||
| - external: ecs | ||
| name: cloud.region | ||
| - external: ecs | ||
| name: ecs.version | ||
| - external: ecs | ||
| name: error | ||
| - external: ecs | ||
| name: error.message | ||
| - external: ecs | ||
| name: service.type | ||
| - external: ecs | ||
| name: host.architecture | ||
| - external: ecs | ||
| name: host.domain | ||
| - external: ecs | ||
| name: host.hostname | ||
| - external: ecs | ||
| name: host.id | ||
| - external: ecs | ||
| name: host.ip | ||
| - external: ecs | ||
| name: host.mac | ||
| - external: ecs | ||
| name: host.name | ||
| - external: ecs | ||
| name: host.os.family | ||
| - external: ecs | ||
| name: host.os.kernel | ||
| - external: ecs | ||
| name: host.os.name | ||
| - external: ecs | ||
| name: host.os.platform | ||
| - external: ecs | ||
| name: host.os.version | ||
| - external: ecs | ||
| name: host.type | ||
| - external: ecs | ||
| name: cloud.instance.name | ||
| - external: ecs | ||
| name: cloud.project.id | ||
| - external: ecs | ||
| name: container.id | ||
| - external: ecs | ||
| name: container.image.name | ||
| - external: ecs | ||
| name: container.labels | ||
| - external: ecs | ||
| name: container.name |
103 changes: 103 additions & 0 deletions
103
packages/aws/data_stream/apigateway_metrics/fields/fields.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| - name: aws | ||
| type: group | ||
| fields: | ||
| - name: apigateway | ||
| type: group | ||
| fields: | ||
| - name: metrics | ||
| type: group | ||
| fields: | ||
| - name: 4XXError.sum | ||
| type: long | ||
| description: The number of client-side errors captured in a given period. | ||
| metric_type: counter | ||
| - name: 4xx.sum | ||
| type: long | ||
| description: The number of client-side errors captured in a given period. | ||
zmoog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| metric_type: counter | ||
| - name: 5XXError.sum | ||
| type: long | ||
| description: The number of server-side errors captured in a given period. | ||
| metric_type: counter | ||
| - name: 5xx.sum | ||
| type: long | ||
| description: The number of server-side errors captured in a given period. | ||
| metric_type: counter | ||
| - name: Count.sum | ||
| type: long | ||
| description: The total number API requests in a given period. | ||
| metric_type: counter | ||
| - name: IntegrationLatency.avg | ||
| type: long | ||
| description: The time between when API Gateway relays a request to the backend and when it receives a response from the backend. | ||
| metric_type: gauge | ||
| unit: ms | ||
| - name: Latency.avg | ||
| type: long | ||
| description: The time between when API Gateway receives a request from a client and when it returns a response to the client. | ||
| metric_type: gauge | ||
| unit: ms | ||
| - name: DataProcessed.avg | ||
| type: long | ||
| description: The amount of data processed in bytes. | ||
| metric_type: gauge | ||
| unit: byte | ||
| - name: CacheHitCount.sum | ||
| type: long | ||
| description: The number of requests served from the API cache in a given period. | ||
| metric_type: counter | ||
| - name: CacheMissCount.sum | ||
| type: long | ||
| description: The number of requests served from the backend in a given period, when API caching is enabled. | ||
| metric_type: counter | ||
| - name: Count.sum | ||
| type: long | ||
| description: The total number of API requests in a given period. | ||
| metric_type: counter | ||
| - name: ConnectCount.sum | ||
| type: long | ||
| description: The number of messages sent to the connect route integration. | ||
| metric_type: counter | ||
| - name: MessageCount.sum | ||
| type: long | ||
| description: The number of messages sent to the WebSocket API, either from or to the client. | ||
| metric_type: counter | ||
| - name: IntegrationError.sum | ||
| type: long | ||
| description: The number of requests that return a 4XX/5XX response from the integration. | ||
| metric_type: counter | ||
| - name: ClientError.sum | ||
| type: long | ||
| description: The number of requests that have a 4XX response returned by API Gateway before the integration is invoked. | ||
| metric_type: counter | ||
| - name: ExecutionError.sum | ||
| type: long | ||
| description: Errors that occurred when calling the integration. | ||
| metric_type: counter | ||
| - name: dimensions | ||
| type: group | ||
| fields: | ||
| - name: ApiId | ||
| type: keyword | ||
| description: Each API created in API Gateway is assigned a unique ApiId, which is used to distinguish and reference that specific API within the system. | ||
lucian-ioan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Stage | ||
| type: keyword | ||
| description: It represents a specific version of the API that is accessible to clients. A stage allows you to manage different environments or versions of your API, such as development, testing, and production. | ||
| - name: Route | ||
| type: keyword | ||
| description: Routes define the path and HTTP methods that clients can use to access different functionalities of the API. | ||
| - name: ApiName | ||
| type: keyword | ||
| description: It represents a human-readable name that helps identify and differentiate the API within the API Gateway service. | ||
| - name: Method | ||
| type: keyword | ||
| description: It represents the HTTP method which defines the action that can be performed on a resource, such as retrieving, creating, updating, or deleting data. | ||
| - name: Resource | ||
| type: keyword | ||
| description: It represents an endpoint within the API that corresponds to a specific functionality, typically associated with a URL path segment. | ||
| - name: cloudwatch | ||
| type: group | ||
| fields: | ||
| - name: namespace | ||
| type: keyword | ||
| description: The namespace specified when query cloudwatch api. | ||
15 changes: 15 additions & 0 deletions
15
packages/aws/data_stream/apigateway_metrics/fields/package-fields.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| - name: aws | ||
| type: group | ||
| fields: | ||
| - name: tags.* | ||
| type: object | ||
| description: | | ||
| Tag key-value pairs from AWS resources. | ||
| - name: s3.bucket.name | ||
| type: keyword | ||
| description: | | ||
| Name of a S3 bucket. | ||
| - name: dimensions.* | ||
| type: object | ||
| description: | | ||
| Metric dimensions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| title: AWS API Gateway metrics | ||
| type: metrics | ||
| streams: | ||
| - input: aws/metrics | ||
| vars: | ||
| - name: period | ||
| type: text | ||
| title: Collection Period | ||
| multi: false | ||
| required: true | ||
| show_user: true | ||
| default: 5m | ||
| - name: data_granularity | ||
| type: text | ||
| title: Data Granularity | ||
| multi: false | ||
| required: false | ||
| show_user: false | ||
| - name: regions | ||
| type: text | ||
| title: Regions | ||
| multi: true | ||
| required: false | ||
| show_user: true | ||
| - name: latency | ||
lucian-ioan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description: To address latency issues between certain AWS services and CloudWatch, specify a latency parameter to adjust the collection start time and end time in Metricbeat such as `5m`. | ||
| type: text | ||
| title: Latency | ||
| multi: false | ||
| required: false | ||
| show_user: false | ||
| title: AWS API Gateway metrics | ||
| description: Collect AWS API Gateway metrics | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.