diff --git a/.github/workflows/skywalking.yaml b/.github/workflows/skywalking.yaml index d78e29f60f08..7fb526535087 100644 --- a/.github/workflows/skywalking.yaml +++ b/.github/workflows/skywalking.yaml @@ -673,9 +673,10 @@ jobs: config: test/e2e-v2/cases/aws/s3/e2e.yaml - name: AWS Cloud DynamoDB config: test/e2e-v2/cases/aws/dynamodb/e2e.yaml - - name: PromQL Service config: test/e2e-v2/cases/promql/e2e.yaml + - name: AWS API Gateway + config: test/e2e-v2/cases/aws/api-gateway/e2e.yaml steps: - uses: actions/checkout@v3 with: diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 568cc38e69a1..77456573958f 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -27,6 +27,7 @@ * Support collecting memory buff/cache metrics in VM monitoring. * PromQL: Remove empty values from the query result, fix `/api/v1/metadata` param `limit` could cause out of bound. * Support monitoring the total number metrics of k8s StatefulSet and DaemonSet. +* Support Amazon API Gateway monitoring. #### UI * Revert: cpm5d function. This feature is cancelled from backend. diff --git a/docs/en/setup/backend/backend-aws-api-gateway-monitoring.md b/docs/en/setup/backend/backend-aws-api-gateway-monitoring.md new file mode 100644 index 000000000000..1570076dba67 --- /dev/null +++ b/docs/en/setup/backend/backend-aws-api-gateway-monitoring.md @@ -0,0 +1,46 @@ +# AWS API Gateway monitoring +Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs. SkyWalking leverages [AWS Kinesis Data Firehose receiver](./aws-firehose-receiver.md) to transfer the CloudWatch metrics of API Gateway(HTTP and REST APIs) to +[OpenTelemetry receiver](opentelemetry-receiver.md) and into the [Meter System](./../../concepts-and-designs/meter.md). + +### Data flow +1. AWS CloudWatch collect metrics for API Gateway(REST and HTTP APIs), refer to [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) +2. [CloudWatch metric streams](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html) stream CloudWatch metrics of API Gateway to AWS Kinesis Data Firehose +3. AWS Kinesis Data Firehose delivery metrics to [AWS Kinesis Data Firehose receiver](./aws-firehose-receiver.md) through the HTTP endpoint + +### Set up +1. Enable CloudWatch metrics for API Gateway +2. Create an Amazon Kinesis Data Firehose Delivery Stream, and set [AWS Kinesis Data Firehose receiver](./aws-firehose-receiver.md)'s address as HTTP(s) Destination, refer to [Create Delivery Stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html) +3. Create CloudWatch metric stream, and select the Firehose Delivery Stream which has been created above, set `Select namespaces` to `AWS/ApiGateway`, `Select output format` to `OpenTelemetry 0.7`. refer to [CloudWatch Metric Streams](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html) + +### Gateway Monitoring + +SkyWalking observes CloudWatch metrics of the AWS API Gateway, which is cataloged as a `LAYER: AWS_GATEWAY` `Service` in the OAP. Meanwhile, the routes would be recognized as `LAYER: AWS_GATEWAY` `endpoint`s + +#### Supported Metrics + +| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | +|-------------------------------------|-------|------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Request Count | count | aws_gateway_service_count | Service | The total number API requests in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| 4xx Count | count | aws_gateway_service_4xx | Service | The number of client-side errors captured in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| 5xx Count | count | aws_gateway_service_5xx | Service | The number of server-side errors captured in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Request Average Latency | ms | aws_gateway_service_latency | Service | The time between when API Gateway receives a request from a client and when it returns a response to the client. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Request Average Integration Latency | ms | aws_gateway_service_integration_latency | Service | The time between when API Gateway relays a request to the backend and when it receives a response from the backend. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Data Processed | KB | aws_gateway_service_data_processed | Service | The amount of data processed | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) | +| Cache Hit Count Rate | % | aws_gateway_service_cache_hit_rate | Service | The number of requests served from the API cache | [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Cache Miss Count Rate | % | aws_gateway_service_cache_miss_rate | Service | The number of requests served from the backend | [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Request Count | count | aws_gateway_endpoint_count | Endpoint | The total number API requests in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| 4xx Count | count | aws_gateway_endpoint_4xx | Endpoint | The number of client-side errors captured in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| 5xx Count | count | aws_gateway_endpoint_5xx | Endpoint | The number of server-side errors captured in a given period. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Request Average Latency | ms | aws_gateway_endpoint_latency | Endpoint | The time between when API Gateway receives a request from a client and when it returns a response to the client. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Request Average Integration Latency | ms | aws_gateway_endpoint_integration_latency | Endpoint | The time between when API Gateway relays a request to the backend and when it receives a response from the backend. | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) and [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Data Processed | KB | aws_gateway_endpoint_data_processed | Endpoint | The amount of data processed | [API Gateway HTTP APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html) | +| Cache Hit Count Rate | % | aws_gateway_endpoint_cache_hit_rate | Endpoint | The number of requests served from the API cache | [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | +| Cache Miss Count Rate | % | aws_gateway_endpoint_cache_miss_rate | Endpoint | The number of requests served from the backend | [API Gateway REST APIs monitoring with CloudWatch](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) | + + + + +### Customizations +You can customize your own metrics/expression/dashboard panel. +The metrics definition and expression rules are found in `/config/otel-rules/aws-gateway/`. +The AWS Cloud EKS dashboard panel configurations are found in `/config/ui-initialized-templates/aws_gateway`. diff --git a/docs/menu.yml b/docs/menu.yml index fbf1bd695c7d..403ff939604b 100644 --- a/docs/menu.yml +++ b/docs/menu.yml @@ -205,12 +205,16 @@ catalog: path: "/en/setup/backend/backend-aws-s3-monitoring" - name: "AWS DynamoDB" path: "/en/setup/backend/backend-aws-dynamodb-monitoring" + - name: "AWS API Gateway" + path: "/en/setup/backend/backend-aws-api-gateway-monitoring" - name: "Browser Monitoring" path: "/en/setup/service-agent/browser-agent" - name: "Gateway Monitoring" catalog: - name: "APISIX Monitoring" path: "/en/setup/backend/backend-apisix-monitoring" + - name: "AWS API Gateway" + path: "/en/setup/backend/backend-aws-api-gateway-monitoring" - name: "Database Monitoring" catalog: - name: "MySQL/MariaDB Server" diff --git a/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java b/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java index 96326e3ecb07..4f5374ed9da9 100644 --- a/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java +++ b/oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java @@ -464,7 +464,7 @@ public SampleFamily instance(List serviceKeys, List instanceKeys return instance(serviceKeys, Const.POINT, instanceKeys, Const.POINT, layer, null); } - public SampleFamily endpoint(List serviceKeys, List endpointKeys, Layer layer) { + public SampleFamily endpoint(List serviceKeys, List endpointKeys, String delimiter, Layer layer) { Preconditions.checkArgument(serviceKeys.size() > 0); Preconditions.checkArgument(endpointKeys.size() > 0); ExpressionParsingContext.get().ifPresent(ctx -> { @@ -475,7 +475,11 @@ public SampleFamily endpoint(List serviceKeys, List endpointKeys if (this == EMPTY) { return EMPTY; } - return createMeterSamples(new EndpointEntityDescription(serviceKeys, endpointKeys, layer, Const.POINT)); + return createMeterSamples(new EndpointEntityDescription(serviceKeys, endpointKeys, layer, delimiter)); + } + + public SampleFamily endpoint(List serviceKeys, List endpointKeys, Layer layer) { + return endpoint(serviceKeys, endpointKeys, Const.POINT, layer); } public SampleFamily process(List serviceKeys, List serviceInstanceKeys, List processKeys, String layerKey) { diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java index 7dc212ea75c2..3756b25a2c59 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java @@ -119,7 +119,8 @@ public enum Layer { K8S_SERVICE(17, true), /** - * MySQL Server, also known as mysqld, is a single multithreaded program that does most of the work in a MySQL installation. + * MySQL Server, also known as mysqld, is a single multithreaded program that does most of the work in a MySQL + * installation. */ MYSQL(18, true), @@ -153,11 +154,17 @@ public enum Layer { */ AWS_S3(24, true), - /* + /** * Amazon DynamoDB is a fully managed NoSQL database service that provides * fast and predictable performance with seamless scalability. */ - AWS_DYNAMODB(25, true); + AWS_DYNAMODB(25, true), + + /** + * Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, + * and WebSocket APIs at any scale. + */ + AWS_GATEWAY(26, true); private final int value; /** diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java index 243e25e001e4..1b2da1deb7d9 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java @@ -64,6 +64,7 @@ public class UITemplateInitializer { Layer.OS_WINDOWS.name(), Layer.AWS_S3.name(), Layer.AWS_DYNAMODB.name(), + Layer.AWS_GATEWAY.name(), "custom" }; private final UITemplateManagementService uiTemplateManagementService; diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/expect.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/expect.json new file mode 100644 index 000000000000..ad6600e87a3e --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/expect.json @@ -0,0 +1,469 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "IntegrationLatency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/source.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/source.json new file mode 100644 index 000000000000..705e082814ee --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-1/source.json @@ -0,0 +1,401 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "instrumentationLibraryMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Latency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "4xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "4xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Latency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Count" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "IntegrationLatency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "DataProcessed" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "4xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Count" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/expect.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/expect.json new file mode 100644 index 000000000000..ba0d3fbe19f3 --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/expect.json @@ -0,0 +1,594 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "IntegrationLatency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "IntegrationLatency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "5xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "5xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "5xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/source.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/source.json new file mode 100644 index 000000000000..3d444bf53c86 --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-http-2/source.json @@ -0,0 +1,498 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "instrumentationLibraryMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Latency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "DataProcessed" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "IntegrationLatency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Count" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Count" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "IntegrationLatency" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "5xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "5xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "DataProcessed" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "DataProcessed" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + }, + { + "key": "Method", + "value": "ANY" + }, + { + "key": "Resource", + "value": "/graphql" + }, + { + "key": "Stage", + "value": "$default" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5xx", + "unit": "1", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "5xx" + }, + { + "key": "ApiId", + "value": "6m85d5acx7" + } + ], + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/expect.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/expect.json new file mode 100644 index 000000000000..f72fd9b71b01 --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/expect.json @@ -0,0 +1,298 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/5XXError", + "unit": "{Count}", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "5XXError" + } + }, + { + "key": "ApiName", + "value": { + "stringValue": "fafafa" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5XXError", + "unit": "{Count}", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "5XXError" + } + }, + { + "key": "ApiName", + "value": { + "stringValue": "fafafa" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "prod" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4XXError", + "unit": "{Count}", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4XXError" + } + }, + { + "key": "ApiName", + "value": { + "stringValue": "fafafa" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "prod" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiName", + "value": { + "stringValue": "fafafa" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "prod" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiName", + "value": { + "stringValue": "fafafa" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "{Count}", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/source.json b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/source.json new file mode 100644 index 000000000000..4461e419b98f --- /dev/null +++ b/oap-server/server-receiver-plugin/aws-firehose-receiver/src/test/resources/convertor-test-data/gateway-rest-1/source.json @@ -0,0 +1,258 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "instrumentationLibraryMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/5XXError", + "unit": "{Count}", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "5XXError" + }, + { + "key": "ApiName", + "value": "fafafa" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/5XXError", + "unit": "{Count}", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "5XXError" + }, + { + "key": "ApiName", + "value": "fafafa" + }, + { + "key": "Stage", + "value": "prod" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4XXError", + "unit": "{Count}", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "4XXError" + }, + { + "key": "ApiName", + "value": "fafafa" + }, + { + "key": "Stage", + "value": "prod" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Latency" + }, + { + "key": "ApiName", + "value": "fafafa" + }, + { + "key": "Stage", + "value": "prod" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Latency" + }, + { + "key": "ApiName", + "value": "fafafa" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "quantileValues": [ + { + }, + { + "quantile": 1.0 + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "{Count}", + "doubleSummary": { + "dataPoints": [ + { + "labels": [ + { + "key": "Namespace", + "value": "AWS/ApiGateway" + }, + { + "key": "MetricName", + "value": "Count" + } + ], + "startTimeUnixNano": "1679234760000000000", + "timeUnixNano": "1679234820000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml index 5b9a5d9bbb2b..7eb560f08bd8 100644 --- a/oap-server/server-starter/src/main/resources/application.yml +++ b/oap-server/server-starter/src/main/resources/application.yml @@ -332,7 +332,7 @@ receiver-otel: selector: ${SW_OTEL_RECEIVER:default} default: enabledHandlers: ${SW_OTEL_RECEIVER_ENABLED_HANDLERS:"oc,otlp"} - enabledOtelRules: ${SW_OTEL_RECEIVER_ENABLED_OTEL_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap,aws-eks/*,windows,aws-s3/*,aws-dynamodb/*"} + enabledOtelRules: ${SW_OTEL_RECEIVER_ENABLED_OTEL_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap,aws-eks/*,windows,aws-s3/*,aws-dynamodb/*,aws-gateway/*"} receiver-zipkin: selector: ${SW_RECEIVER_ZIPKIN:-} diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-endpoint.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-endpoint.yaml new file mode 100644 index 000000000000..840adde706af --- /dev/null +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-endpoint.yaml @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +#

+# Examples: +#

+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# 
+ +# ApiId for HTTP APS, ApiName for REST API +filter: "{ tags -> {tags.cloud_provider == 'aws' && tags.Namespace == 'AWS/ApiGateway' && (tags.ApiId || tags.ApiName) && tags.Stage && tags.Method && tags.Resource } }" +expSuffix: tag({tags -> tags.service_name= tags.ApiId ? 'aws-api-gateway::'+tags.Stage+':'+tags.ApiId:'aws-api-gateway::'+tags.Stage+':'+tags.ApiName }).endpoint(['service_name'],['Method','Resource'], ':', Layer.AWS_GATEWAY) +metricPrefix: aws_gateway_endpoint +metricsRules: + # Only for HTTP API + - name: 4xx + exp: amazonaws_com_AWS_ApiGateway_4xx_sum.downsampling(SUM) + - name: 5xx + exp: amazonaws_com_AWS_ApiGateway_5xx_sum.downsampling(SUM) + - name: DataProcessed + exp: amazonaws_com_AWS_ApiGateway_DataProcessed_sum.downsampling(SUM) + + # Only for REST API + - name: 4xx + exp: amazonaws_com_AWS_ApiGateway_4XXError_sum.downsampling(SUM) + - name: 5xx + exp: amazonaws_com_AWS_ApiGateway_5XXError_sum.downsampling(SUM) + + - name: cache_hit_rate + exp: amazonaws_com_AWS_ApiGateway_CacheHitCount_sum.div(amazonaws_com_AWS_ApiGateway_CacheHitCount_count) + - name: cache_miss_rate + exp: amazonaws_com_AWS_ApiGateway_CacheMissCount_sum.div(amazonaws_com_AWS_ApiGateway_CacheMissCount_count) + + # Common metrics for HTTP, REST API + - name: count + exp: amazonaws_com_AWS_ApiGateway_Count.downsampling(SUM) + - name: integration_latency + exp: amazonaws_com_AWS_ApiGateway_IntegrationLatency_sum.div(amazonaws_com_AWS_ApiGateway_IntegrationLatency_count) + - name: latency + exp: amazonaws_com_AWS_ApiGateway_Latency_sum.div(amazonaws_com_AWS_ApiGateway_Latency_count) + diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-service.yaml new file mode 100644 index 000000000000..c1fc82db1f7c --- /dev/null +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-gateway/gateway-service.yaml @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +#

+# Examples: +#

+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# 
+ +# ApiId for HTTP APS, ApiName for REST API +filter: "{ tags -> {tags.cloud_provider == 'aws' && tags.Namespace == 'AWS/ApiGateway' && (tags.ApiId || tags.ApiName) && tags.Stage && !tags.Method && !tags.Resource } }" +expSuffix: tag({tags -> tags.service_name= tags.ApiId ? 'aws-api-gateway::'+tags.Stage+':'+tags.ApiId:'aws-api-gateway::'+tags.Stage+':'+tags.ApiName }).service(['service_name'], Layer.AWS_GATEWAY) +metricPrefix: aws_gateway_service +metricsRules: + # Only for HTTP API + - name: 4xx + exp: amazonaws_com_AWS_ApiGateway_4xx_sum.downsampling(SUM) + - name: 5xx + exp: amazonaws_com_AWS_ApiGateway_5xx_sum.downsampling(SUM) + - name: data_processed + exp: amazonaws_com_AWS_ApiGateway_DataProcessed_sum.downsampling(SUM) + + # Only for REST API + - name: 4xx + exp: amazonaws_com_AWS_ApiGateway_4XXError_sum.downsampling(SUM) + - name: 5xx + exp: amazonaws_com_AWS_ApiGateway_5XXError_sum.downsampling(SUM) + + - name: cache_hit_rate + exp: amazonaws_com_AWS_ApiGateway_CacheHitCount_sum.div(amazonaws_com_AWS_ApiGateway_CacheHitCount_count).multiply(100) + - name: cache_miss_rate + exp: amazonaws_com_AWS_ApiGateway_CacheMissCount_sum.div(amazonaws_com_AWS_ApiGateway_CacheMissCount_count).multiply(100) + + # Common metrics for HTTP, REST API + - name: count + exp: amazonaws_com_AWS_ApiGateway_Count.downsampling(SUM) + - name: integration_latency + exp: amazonaws_com_AWS_ApiGateway_IntegrationLatency_sum.div(amazonaws_com_AWS_ApiGateway_IntegrationLatency_count) + - name: latency + exp: amazonaws_com_AWS_ApiGateway_Latency_sum.div(amazonaws_com_AWS_ApiGateway_Latency_count) + diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway-root.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway-root.json new file mode 100644 index 000000000000..45e75bd851b3 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway-root.json @@ -0,0 +1,68 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +[ + { + "id": "AWS_GATEWAY-Root", + "configuration": { + "children": [ + { + "x": 0, + "y": 2, + "w": 24, + "h": 51, + "i": "0", + "type": "Widget", + "widget": { + "title": "" + }, + "graph": { + "type": "ServiceList", + "dashboardName": "AWS_GATEWAY-service", + "fontSize": 12, + "showXAxis": false, + "showYAxis": false, + "showGroup": true + }, + "moved": false + }, + { + "x": 0, + "y": 0, + "w": 24, + "h": 2, + "i": "100", + "type": "Text", + "graph": { + "fontColor":"blue", + "backgroundColor":"white", + "content":"Provide AWS Cloud API Gateway monitoring through AWS FireHose Receiver", + "fontSize":14, + "textAlign":"left", + "url":"https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-aws-api-gateway-monitoring/" + }, + "moved": false + } + ], + "id": "AWS_GATEWAY-Root", + "layer": "AWS_GATEWAY", + "entity": "All", + "name": "AWS_GATEWAY-Root", + "isRoot": true + } + } +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_endpoint.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_endpoint.json new file mode 100644 index 000000000000..7669a6a7aa79 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_endpoint.json @@ -0,0 +1,237 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +[ + { + "id": "AWS_GATEWAY-endpoint", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Request Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_count" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "4xx Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_4xx" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "5xx Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_5xx" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "5", + "type": "Widget", + "widget": { + "title": "Request Average Latency (ms)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_latency" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "4", + "type": "Widget", + "widget": { + "title": "Request Average Integration Latency (ms)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_integration_latency" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "Data Processed (KB, HTTP API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_data_processed" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + + { + "x": 12, + "y": 13, + "w": 6, + "h": 13, + "i": "7", + "type": "Widget", + "widget": { + "title": "Cache Hit Count Rate (%, REST API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_cache_hit_rate" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 13, + "w": 6, + "h": 13, + "i": "8", + "type": "Widget", + "widget": { + "title": "Cache Miss Count Rate (%, REST API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_endpoint_cache_miss_rate" + ], + "metricTypes": [ + "readMetricsValues" + ] + } + ], + "layer": "AWS_GATEWAY", + "entity": "Endpoint", + "name": "AWS_GATEWAY-endpoint", + "id": "AWS_GATEWAY-endpoint", + "isRoot": false + } + } +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_service.json new file mode 100644 index 000000000000..7639f5f2c8d1 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_gateway/aws_gateway_service.json @@ -0,0 +1,291 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +[ + { + "id": "AWS_GATEWAY-service", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Request Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_count" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "4xx Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_4xx" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "5xx Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_5xx" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "5", + "type": "Widget", + "widget": { + "title": "Request Average Latency (ms)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_latency" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "4", + "type": "Widget", + "widget": { + "title": "Request Average Integration Latency (ms)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_integration_latency" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "Data Processed (KB, HTTP API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_data_processed" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + + { + "x": 12, + "y": 13, + "w": 6, + "h": 13, + "i": "7", + "type": "Widget", + "widget": { + "title": "Cache Hit Count Rate (%, REST API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_cache_hit_rate" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 13, + "w": 6, + "h": 13, + "i": "8", + "type": "Widget", + "widget": { + "title": "Cache Miss Count Rate (%, REST API Only)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "aws_gateway_service_cache_miss_rate" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 0, + "y": 26, + "w": 24, + "h": 26, + "i": "9", + "type": "Widget", + "graph": { + "type": "EndpointList", + "dashboardName": "AWS_GATEWAY-endpoint", + "fontSize": 12, + "showXAxis": false, + "showYAxis": false, + "showGroup": true + }, + "metrics": [ + "aws_gateway_endpoint_count", + "aws_gateway_endpoint_4xx", + "aws_gateway_endpoint_5xx", + "aws_gateway_endpoint_latency", + "aws_gateway_endpoint_integration_latency" + ], + "metricTypes": [ + "readMetricsValues", + "readMetricsValues", + "readMetricsValues", + "readMetricsValues", + "readMetricsValues" + ], + "metricConfig": [ + { + "label": "Request Count", + "calculation": "average" + }, + { + "label": "4xx Count", + "calculation": "average" + }, + { + "label": "5xx Count", + "calculation": "average" + }, + { + "label": "Latency", + "unit": "ms", + "calculation": "average" + }, + { + "label": "Integration Latency", + "unit": "ms", + "calculation": "average" + } + ] + } + ], + "layer": "AWS_GATEWAY", + "entity": "Service", + "name": "AWS_GATEWAY-service", + "id": "AWS_GATEWAY-service", + "isRoot": false + } + } +] diff --git a/test/e2e-v2/cases/aws/api-gateway/docker-compose.yml b/test/e2e-v2/cases/aws/api-gateway/docker-compose.yml new file mode 100644 index 000000000000..dcd2cfc5af6f --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/docker-compose.yml @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '2.1' + +services: + oap: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: oap + ports: + - 12800 + networks: + e2e: + + sender: + image: "eclipse-temurin:8-jre" + volumes: + - ./../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar + - ./mock-data:/data/otel-metrics + command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ] + environment: + OAP_HOST: oap + OAP_GRPC_PORT: 11800 + OTEL_METRICS_DATA_PATH: /data/otel-metrics + networks: + - e2e + ports: + - 9093:9093 + healthcheck: + test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 9093"] + interval: 5s + timeout: 60s + retries: 120 + depends_on: + oap: + condition: service_healthy +networks: + e2e: diff --git a/test/e2e-v2/cases/aws/api-gateway/e2e.yaml b/test/e2e-v2/cases/aws/api-gateway/e2e.yaml new file mode 100644 index 000000000000..358fab7090ed --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/e2e.yaml @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is used to show how to write configuration files and can be used to test. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../script/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + +trigger: + action: http + interval: 3s + times: 10 + url: http://localhost:9093/otel-metrics/send + method: GET + +verify: + retry: + count: 10 + interval: 3s + cases: + - includes: + - ./gateway-cases.yaml diff --git a/test/e2e-v2/cases/aws/api-gateway/expected/metrics-has-value.yml b/test/e2e-v2/cases/aws/api-gateway/expected/metrics-has-value.yml new file mode 100644 index 000000000000..247a7cafc869 --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/expected/metrics-has-value.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- contains . }} +- key: {{ notEmpty .key }} + value: + value: 0 + isemptyvalue: true +- key: {{ notEmpty .key }} + value: + value: {{ gt .value.value 0 }} + isemptyvalue: false + {{- end }} diff --git a/test/e2e-v2/cases/aws/api-gateway/expected/service.yml b/test/e2e-v2/cases/aws/api-gateway/expected/service.yml new file mode 100644 index 000000000000..22818cce2e4f --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/expected/service.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + {{- contains . }} +- id: {{ b64enc "aws-api-gateway::$default:6m85d5acx7" }}.1 + name: "aws-api-gateway::$default:6m85d5acx7" + group: aws-api-gateway + shortname: '$default:6m85d5acx7' + normal: true + layers: + - AWS_GATEWAY + {{- end }} diff --git a/test/e2e-v2/cases/aws/api-gateway/gateway-cases.yaml b/test/e2e-v2/cases/aws/api-gateway/gateway-cases.yaml new file mode 100644 index 000000000000..f28f8729a6e8 --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/gateway-cases.yaml @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is used to show how to write configuration files and can be used to test. + + cases: + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/service.yml + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ + --name=aws_gateway_service_4xx --service-name='aws-api-gateway::$default:6m85d5acx7' |yq e 'to_entries' - + expected: expected/metrics-has-value.yml + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \ + --name=aws_gateway_endpoint_latency --endpoint-name='ANY:/graphql' \ + --service-name='aws-api-gateway::$default:6m85d5acx7' |yq e 'to_entries' - + expected: expected/metrics-has-value.yml diff --git a/test/e2e-v2/cases/aws/api-gateway/mock-data/data-1.json b/test/e2e-v2/cases/aws/api-gateway/mock-data/data-1.json new file mode 100644 index 000000000000..ad6600e87a3e --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/mock-data/data-1.json @@ -0,0 +1,469 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "IntegrationLatency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +} diff --git a/test/e2e-v2/cases/aws/api-gateway/mock-data/data-2.json b/test/e2e-v2/cases/aws/api-gateway/mock-data/data-2.json new file mode 100644 index 000000000000..ad6600e87a3e --- /dev/null +++ b/test/e2e-v2/cases/aws/api-gateway/mock-data/data-2.json @@ -0,0 +1,469 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "cloud.provider", + "value": { + "stringValue": "aws" + } + }, + { + "key": "cloud.account.id", + "value": { + "stringValue": "008835616606" + } + }, + { + "key": "cloud.region", + "value": { + "stringValue": "ap-northeast-1" + } + }, + { + "key": "aws.exporter.arn", + "value": { + "stringValue": "arn:aws:cloudwatch:ap-northeast-1:008835616606:metric-stream/CustomPartial" + } + } + ] + }, + "scopeMetrics": [ + { + "metrics": [ + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Latency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 376.0, + "quantileValues": [ + { + "value": 11.0 + }, + { + "quantile": 1.0, + "value": 104.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Latency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/IntegrationLatency", + "unit": "ms", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 32.0, + "quantileValues": [ + { + "value": 3.0 + }, + { + "quantile": 1.0, + "value": 8.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "IntegrationLatency" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/DataProcessed", + "unit": "By", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 2775.0, + "quantileValues": [ + { + "value": 555.0 + }, + { + "quantile": 1.0, + "value": 555.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "DataProcessed" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/4xx", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "4xx" + } + }, + { + "key": "ApiId", + "value": { + "stringValue": "6m85d5acx7" + } + }, + { + "key": "Method", + "value": { + "stringValue": "ANY" + } + }, + { + "key": "Resource", + "value": { + "stringValue": "/graphql" + } + }, + { + "key": "Stage", + "value": { + "stringValue": "$default" + } + } + ] + } + ] + } + }, + { + "name": "amazonaws.com/AWS/ApiGateway/Count", + "unit": "1", + "summary": { + "dataPoints": [ + { + "startTimeUnixNano": "1679195460000000000", + "timeUnixNano": "1679195520000000000", + "count": "5", + "sum": 5.0, + "quantileValues": [ + { + "value": 1.0 + }, + { + "quantile": 1.0, + "value": 1.0 + } + ], + "attributes": [ + { + "key": "Namespace", + "value": { + "stringValue": "AWS/ApiGateway" + } + }, + { + "key": "MetricName", + "value": { + "stringValue": "Count" + } + } + ] + } + ] + } + } + ] + } + ] + } + ] +}