mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 01:15:52 +08:00
chore: AWS Integration: include CWAgent metrics namespace for ec2 (#7165)
* chore: include CWAgent namespace for ec2 metrics * chore: update aws integration service metrics connection status queried labels * chore: fix breaking test
This commit is contained in:
parent
b6858fbfd9
commit
bc907b9e61
@ -497,6 +497,9 @@
|
|||||||
"cloudwatch_metric_stream_filters": [
|
"cloudwatch_metric_stream_filters": [
|
||||||
{
|
{
|
||||||
"Namespace": "AWS/EC2"
|
"Namespace": "AWS/EC2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Namespace": "CWAgent"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4242,19 +4242,21 @@ func (aH *APIHandler) calculateAWSIntegrationSvcMetricsConnectionStatus(
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
metricsNamespace := strategy.CloudwatchMetricsStreamFilters[0].Namespace
|
|
||||||
metricsNamespaceParts := strings.Split(metricsNamespace, "/")
|
|
||||||
if len(metricsNamespaceParts) < 2 {
|
|
||||||
return nil, model.InternalError(fmt.Errorf(
|
|
||||||
"unexpected metric namespace: %s", metricsNamespace,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedLabelValues := map[string]string{
|
expectedLabelValues := map[string]string{
|
||||||
"cloud_provider": "aws",
|
"cloud_provider": "aws",
|
||||||
"cloud_account_id": cloudAccountId,
|
"cloud_account_id": cloudAccountId,
|
||||||
"service_namespace": metricsNamespaceParts[0],
|
}
|
||||||
"service_name": metricsNamespaceParts[1],
|
|
||||||
|
metricsNamespace := strategy.CloudwatchMetricsStreamFilters[0].Namespace
|
||||||
|
metricsNamespaceParts := strings.Split(metricsNamespace, "/")
|
||||||
|
|
||||||
|
if len(metricsNamespaceParts) >= 2 {
|
||||||
|
expectedLabelValues["service_namespace"] = metricsNamespaceParts[0]
|
||||||
|
expectedLabelValues["service_name"] = metricsNamespaceParts[1]
|
||||||
|
} else {
|
||||||
|
// metrics for single word namespaces like "CWAgent" do not
|
||||||
|
// have the service_namespace label populated
|
||||||
|
expectedLabelValues["service_name"] = metricsNamespaceParts[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
metricNamesCollectedBySvc := []string{}
|
metricNamesCollectedBySvc := []string{}
|
||||||
|
@ -281,7 +281,7 @@ func TestConfigReturnedWhenAgentChecksIn(t *testing.T) {
|
|||||||
for _, f := range telemetryCollectionStrategy.AWSMetrics.CloudwatchMetricsStreamFilters {
|
for _, f := range telemetryCollectionStrategy.AWSMetrics.CloudwatchMetricsStreamFilters {
|
||||||
metricStreamNamespaces = append(metricStreamNamespaces, f.Namespace)
|
metricStreamNamespaces = append(metricStreamNamespaces, f.Namespace)
|
||||||
}
|
}
|
||||||
require.Equal([]string{"AWS/EC2", "AWS/RDS"}, metricStreamNamespaces)
|
require.Equal([]string{"AWS/EC2", "CWAgent", "AWS/RDS"}, metricStreamNamespaces)
|
||||||
|
|
||||||
require.NotNil(telemetryCollectionStrategy.AWSLogs)
|
require.NotNil(telemetryCollectionStrategy.AWSLogs)
|
||||||
logGroupPrefixes := []string{}
|
logGroupPrefixes := []string{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user