Skip to content

Commit 93ad6ed

Browse files
Merge branch 'sw' of https://github.com/kezhenxu94/argo-rollouts into sw
2 parents 6454e22 + e37fea1 commit 93ad6ed

22 files changed

+1431
-512
lines changed

docs/analysis/skywalking.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Apache SkyWalking Metrics
2+
3+
!!! important
4+
Available since v1.5.0
5+
6+
A [SkyWalking](https://skywalking.apache.org/) query using GraphQL can be used to obtain measurements for analysis.
7+
8+
```yaml
9+
apiVersion: argoproj.io/v1alpha1
10+
kind: AnalysisTemplate
11+
metadata:
12+
name: apdex
13+
spec:
14+
args:
15+
- name: service-name
16+
metrics:
17+
- name: apdex
18+
interval: 5m
19+
successCondition: "all(result.service_apdex.values.values, {asFloat(.value) >= 9900})"
20+
failureLimit: 3
21+
provider:
22+
skywalking:
23+
interval: 3m
24+
address: http://skywalking-oap.istio-system:12800
25+
query: |
26+
query queryData($duration: Duration!) {
27+
service_apdex: readMetricsValues(
28+
condition: { name: "service_apdex", entity: { scope: Service, serviceName: "{{ args.service-name }}", normal: true } },
29+
duration: $duration) {
30+
label values { values { value } }
31+
}
32+
}
33+
```
34+
35+
The `result` evaluated for the query depends on the specific GraphQL you give, you can try to run the GraphQL query first and inspect the output format, then compose the condition.

docs/features/kustomize/rollout_cr_schema.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,6 +4176,20 @@
41764176
},
41774177
"type": "object"
41784178
},
4179+
"skywalking": {
4180+
"properties": {
4181+
"address": {
4182+
"type": "string"
4183+
},
4184+
"interval": {
4185+
"type": "string"
4186+
},
4187+
"query": {
4188+
"type": "string"
4189+
}
4190+
},
4191+
"type": "object"
4192+
},
41794193
"wavefront": {
41804194
"properties": {
41814195
"address": {
@@ -8444,6 +8458,20 @@
84448458
},
84458459
"type": "object"
84468460
},
8461+
"skywalking": {
8462+
"properties": {
8463+
"address": {
8464+
"type": "string"
8465+
},
8466+
"interval": {
8467+
"type": "string"
8468+
},
8469+
"query": {
8470+
"type": "string"
8471+
}
8472+
},
8473+
"type": "object"
8474+
},
84478475
"wavefront": {
84488476
"properties": {
84498477
"address": {
@@ -12712,6 +12740,20 @@
1271212740
},
1271312741
"type": "object"
1271412742
},
12743+
"skywalking": {
12744+
"properties": {
12745+
"address": {
12746+
"type": "string"
12747+
},
12748+
"interval": {
12749+
"type": "string"
12750+
},
12751+
"query": {
12752+
"type": "string"
12753+
}
12754+
},
12755+
"type": "object"
12756+
},
1271512757
"wavefront": {
1271612758
"properties": {
1271712759
"address": {

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/argoproj/notifications-engine v0.3.1-0.20221206124514-c419c904e2c0
88
github.com/argoproj/pkg v0.13.6
99
github.com/aws/aws-sdk-go-v2 v1.17.3
10-
github.com/aws/aws-sdk-go-v2/config v1.18.5
10+
github.com/aws/aws-sdk-go-v2/config v1.18.6
1111
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.23.1
1212
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.18.28
1313
github.com/blang/semver v3.5.1+incompatible
@@ -53,6 +53,8 @@ require (
5353

5454
)
5555

56+
require github.com/matryer/is v1.4.0 // indirect
57+
5658
require (
5759
cloud.google.com/go/compute v1.7.0 // indirect
5860
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
@@ -68,14 +70,14 @@ require (
6870
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
6971
github.com/PagerDuty/go-pagerduty v1.6.0 // indirect
7072
github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20220708192748-b73dcb041214 // indirect
71-
github.com/aws/aws-sdk-go-v2/credentials v1.13.5 // indirect
73+
github.com/aws/aws-sdk-go-v2/credentials v1.13.6 // indirect
7274
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
7375
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
7476
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
7577
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
7678
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
7779
github.com/aws/aws-sdk-go-v2/service/sso v1.11.27 // indirect
78-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.10 // indirect
80+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 // indirect
7981
github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 // indirect
8082
github.com/aws/smithy-go v1.13.5 // indirect
8183
github.com/beorn7/perks v1.0.1 // indirect
@@ -121,6 +123,7 @@ require (
121123
github.com/json-iterator/go v1.1.12 // indirect
122124
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
123125
github.com/lunixbochs/vtclean v1.0.0 // indirect
126+
github.com/machinebox/graphql v0.2.2
124127
github.com/mailru/easyjson v0.7.7 // indirect
125128
github.com/mattn/go-colorable v0.1.12 // indirect
126129
github.com/mattn/go-isatty v0.0.14 // indirect

go.sum

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ github.com/aws/aws-sdk-go v1.38.49/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2z
147147
github.com/aws/aws-sdk-go v1.44.39/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
148148
github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
149149
github.com/aws/aws-sdk-go-v2 v1.17.3/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
150-
github.com/aws/aws-sdk-go-v2/config v1.18.5 h1:teGdDCAT3gX99FIKNt6HsvLaeOVdCFiCQDlH8UV6Xvg=
151-
github.com/aws/aws-sdk-go-v2/config v1.18.5/go.mod h1:0g4tGVHeUTxekZIkO5Glw2AemETlmnkQvFqkdv3HBAA=
152-
github.com/aws/aws-sdk-go-v2/credentials v1.13.5 h1:vrPwnKCdQlUyxXDZtPpb6Hc3GbTndqaGtEOwm/lF5tI=
153-
github.com/aws/aws-sdk-go-v2/credentials v1.13.5/go.mod h1:sS/NgdbdkQ6XhVkGY/yEmNwxzpRVxLT3Ns+42W37p6g=
150+
github.com/aws/aws-sdk-go-v2/config v1.18.6 h1:iSuEAeervBWMHA7Aaq5hCNfwuN2m7x2VuQCnEbbQg68=
151+
github.com/aws/aws-sdk-go-v2/config v1.18.6/go.mod h1:qyjgnyqpKnNGT+C62zMsrZ/Mn2OodYqwIH0DpXiW8f8=
152+
github.com/aws/aws-sdk-go-v2/credentials v1.13.6 h1:BXOMvv3O82/4JLggIi67WKlTO56f0rliCKBT4CKyf0o=
153+
github.com/aws/aws-sdk-go-v2/credentials v1.13.6/go.mod h1:VbnUvhw31DUu6aiubViixQwWCBNO/st84dhPeOkmdls=
154154
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 h1:j9wi1kQ8b+e0FBVHxCqCGo4kxDU175hoDHcWAi0sauU=
155155
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21/go.mod h1:ugwW57Z5Z48bpvUyZuaPy4Kv+vEfJWnIrky7RmkBvJg=
156156
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 h1:I3cakv2Uy1vNmmhRQmFptYDxOvBnwCdNwyw63N0RaRU=
@@ -167,8 +167,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 h1:5C6XgTViS
167167
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21/go.mod h1:lRToEJsn+DRA9lW4O9L9+/3hjTkUzlzyzHqn8MTds5k=
168168
github.com/aws/aws-sdk-go-v2/service/sso v1.11.27 h1:Nmvn0DJKg00TBmoBweK253Kdsuy4V5Rs68yL/H15uBQ=
169169
github.com/aws/aws-sdk-go-v2/service/sso v1.11.27/go.mod h1:wo/B7uUm/7zw/dWhBJ4FXuw1sySU5lyIhVg1Bu2yL9A=
170-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.10 h1:tGOUUjINuqI8sD6pn+Ku0/f/4UfRDlK+jJUOaxEbWuQ=
171-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.10/go.mod h1:TZSH7xLO7+phDtViY/KUp9WGCJMQkLJ/VpgkTFd5gh8=
170+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 h1:KCacyVSs/wlcPGx37hcbT3IGYO8P8Jx+TgSDhAXtQMY=
171+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11/go.mod h1:TZSH7xLO7+phDtViY/KUp9WGCJMQkLJ/VpgkTFd5gh8=
172172
github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 h1:9Mtq1KM6nD8/+HStvWcvYnixJ5N85DX+P+OY3kI3W2k=
173173
github.com/aws/aws-sdk-go-v2/service/sts v1.17.7/go.mod h1:+lGbb3+1ugwKrNTWcf2RT05Xmp543B06zDFTwiTLp7I=
174174
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
@@ -667,6 +667,8 @@ github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+L
667667
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
668668
github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5/go.mod h1:c2mYKRyMb1BPkO5St0c/ps62L4S0W2NAkaTXj9qEI+0=
669669
github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018/go.mod h1:sFlOUpQL1YcjhFVXhg1CG8ZASEs/Mf1oVb6H75JL/zg=
670+
github.com/machinebox/graphql v0.2.2 h1:dWKpJligYKhYKO5A2gvNhkJdQMNZeChZYyBbrZkBZfo=
671+
github.com/machinebox/graphql v0.2.2/go.mod h1:F+kbVMHuwrQ5tYgU9JXlnskM8nOaFxCAEolaQybkjWA=
670672
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
671673
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
672674
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
@@ -678,6 +680,8 @@ github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7
678680
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
679681
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
680682
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
683+
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
684+
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
681685
github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk=
682686
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
683687
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=

manifests/crds/analysis-run-crd.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,6 +2707,15 @@ spec:
27072707
query:
27082708
type: string
27092709
type: object
2710+
skywalking:
2711+
properties:
2712+
address:
2713+
type: string
2714+
interval:
2715+
type: string
2716+
query:
2717+
type: string
2718+
type: object
27102719
wavefront:
27112720
properties:
27122721
address:

manifests/crds/analysis-template-crd.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,15 @@ spec:
27032703
query:
27042704
type: string
27052705
type: object
2706+
skywalking:
2707+
properties:
2708+
address:
2709+
type: string
2710+
interval:
2711+
type: string
2712+
query:
2713+
type: string
2714+
type: object
27062715
wavefront:
27072716
properties:
27082717
address:

manifests/crds/cluster-analysis-template-crd.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,15 @@ spec:
27032703
query:
27042704
type: string
27052705
type: object
2706+
skywalking:
2707+
properties:
2708+
address:
2709+
type: string
2710+
interval:
2711+
type: string
2712+
query:
2713+
type: string
2714+
type: object
27062715
wavefront:
27072716
properties:
27082717
address:

manifests/install.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,15 @@ spec:
27082708
query:
27092709
type: string
27102710
type: object
2711+
skywalking:
2712+
properties:
2713+
address:
2714+
type: string
2715+
interval:
2716+
type: string
2717+
query:
2718+
type: string
2719+
type: object
27112720
wavefront:
27122721
properties:
27132722
address:
@@ -5585,6 +5594,15 @@ spec:
55855594
query:
55865595
type: string
55875596
type: object
5597+
skywalking:
5598+
properties:
5599+
address:
5600+
type: string
5601+
interval:
5602+
type: string
5603+
query:
5604+
type: string
5605+
type: object
55885606
wavefront:
55895607
properties:
55905608
address:
@@ -8348,6 +8366,15 @@ spec:
83488366
query:
83498367
type: string
83508368
type: object
8369+
skywalking:
8370+
properties:
8371+
address:
8372+
type: string
8373+
interval:
8374+
type: string
8375+
query:
8376+
type: string
8377+
type: object
83518378
wavefront:
83528379
properties:
83538380
address:

manifests/namespace-install.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,15 @@ spec:
27082708
query:
27092709
type: string
27102710
type: object
2711+
skywalking:
2712+
properties:
2713+
address:
2714+
type: string
2715+
interval:
2716+
type: string
2717+
query:
2718+
type: string
2719+
type: object
27112720
wavefront:
27122721
properties:
27132722
address:
@@ -5585,6 +5594,15 @@ spec:
55855594
query:
55865595
type: string
55875596
type: object
5597+
skywalking:
5598+
properties:
5599+
address:
5600+
type: string
5601+
interval:
5602+
type: string
5603+
query:
5604+
type: string
5605+
type: object
55885606
wavefront:
55895607
properties:
55905608
address:
@@ -8348,6 +8366,15 @@ spec:
83488366
query:
83498367
type: string
83508368
type: object
8369+
skywalking:
8370+
properties:
8371+
address:
8372+
type: string
8373+
interval:
8374+
type: string
8375+
query:
8376+
type: string
8377+
type: object
83518378
wavefront:
83528379
properties:
83538380
address:

metricproviders/metricproviders.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55

66
"github.com/argoproj/argo-rollouts/metricproviders/influxdb"
7+
"github.com/argoproj/argo-rollouts/metricproviders/skywalking"
78

89
"github.com/argoproj/argo-rollouts/metricproviders/cloudwatch"
910
"github.com/argoproj/argo-rollouts/metricproviders/datadog"
@@ -101,6 +102,12 @@ func (f *ProviderFactory) NewProvider(logCtx log.Entry, metric v1alpha1.Metric)
101102
return nil, err
102103
}
103104
return influxdb.NewInfluxdbProvider(client, logCtx), nil
105+
case skywalking.ProviderType:
106+
client, err := skywalking.NewSkyWalkingClient(metric, f.KubeClient)
107+
if err != nil {
108+
return nil, err
109+
}
110+
return skywalking.NewSkyWalkingProvider(client, logCtx), nil
104111
default:
105112
return nil, fmt.Errorf("no valid provider in metric '%s'", metric.Name)
106113
}
@@ -127,6 +134,8 @@ func Type(metric v1alpha1.Metric) string {
127134
return graphite.ProviderType
128135
} else if metric.Provider.Influxdb != nil {
129136
return influxdb.ProviderType
137+
} else if metric.Provider.SkyWalking != nil {
138+
return skywalking.ProviderType
130139
}
131140

132141
return "Unknown Provider"

0 commit comments

Comments
 (0)