diff --git a/receiver/huaweicloudcesreceiver/README.md b/receiver/huaweicloudcesreceiver/README.md index a9c4b867d4ac..7ad1aff9172a 100644 --- a/receiver/huaweicloudcesreceiver/README.md +++ b/receiver/huaweicloudcesreceiver/README.md @@ -38,6 +38,10 @@ The following settings are required: - `no_verify_ssl`: A boolean flag indicating whether SSL verification should be disabled. Set to True to disable SSL verification. +- `access_key`: The access key needed for CES authentification. Check `Huawei Cloud SDK Authentication Setup` section for more details. + +- `secret_key`: The secret key needed for CES authentification. Check `Huawei Cloud SDK Authentication Setup` section for more details. + The following settings are optional: - `initial_delay`: The delay before the first collection of metrics begins. This is a duration field, such as 5s for 5 seconds. diff --git a/receiver/huaweicloudcesreceiver/config.go b/receiver/huaweicloudcesreceiver/config.go index 256005b4f1da..a422936306e3 100644 --- a/receiver/huaweicloudcesreceiver/config.go +++ b/receiver/huaweicloudcesreceiver/config.go @@ -77,8 +77,10 @@ type HuaweiSessionConfig struct { var _ component.Config = (*Config)(nil) +// These valid periods are defined by CES API constraints: https://support.huaweicloud.com/intl/en-us/api-ces/ces_03_0034.html#section3 var validPeriods = []int{1, 300, 1200, 3600, 14400, 86400} +// These valid filters are defined by CES API constraints: https://support.huaweicloud.com/intl/en-us/api-ces/ces_03_0034.html#section3 var validFilters = []string{"max", "min", "average", "sum", "variance"} // Validate config diff --git a/receiver/huaweicloudcesreceiver/go.mod b/receiver/huaweicloudcesreceiver/go.mod index 2556808e3bf4..f07b36a72cca 100644 --- a/receiver/huaweicloudcesreceiver/go.mod +++ b/receiver/huaweicloudcesreceiver/go.mod @@ -5,17 +5,17 @@ go 1.22.0 toolchain go1.22.3 require ( - github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.104 + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.110 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.107.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.107.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02 go.opentelemetry.io/collector/receiver v0.106.1 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 @@ -55,19 +55,19 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/tjfoc/gmsm v1.4.1 // indirect go.mongodb.org/mongo-driver v1.15.0 // indirect - go.opentelemetry.io/collector v0.106.1 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtls v1.12.0 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect @@ -75,10 +75,10 @@ require ( go.opentelemetry.io/otel/sdk v1.28.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/receiver/huaweicloudcesreceiver/go.sum b/receiver/huaweicloudcesreceiver/go.sum index b468166a32d1..ad025ef20a1d 100644 --- a/receiver/huaweicloudcesreceiver/go.sum +++ b/receiver/huaweicloudcesreceiver/go.sum @@ -52,8 +52,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.104 h1:mCjW876Kx+y7LYxvbXVUxacN42AH2EJe715iZyPP1Fk= -github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.104/go.mod h1:lhdEO9Bbb3hZ0wG+JeK9/GqMOp/sgc92mFmVk5tNSCk= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.110 h1:XaWasqaF3tzRGw9cFmhXM1IiPAom8Nhg760F9LYHPKg= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.110/go.mod h1:JWz2ujO9X3oU5wb6kXp+DpR2UuDj2SldDbX8T0FSuhI= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -121,48 +121,48 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUSLc= go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= -go.opentelemetry.io/collector v0.106.1 h1:ZSQMpFGzFP3RILe1/+K80kCCT2ahn3MKt5e3u0Yz7Rs= -go.opentelemetry.io/collector v0.106.1/go.mod h1:1FabMxWLluLNcC0dq8cI01GaE6t6fYxE6Oxuf8u7AGQ= -go.opentelemetry.io/collector/client v0.106.1 h1:aBasAp+t7F30lI+oQpT95ZgYMiNaUlYRlgyeEvEGwjk= -go.opentelemetry.io/collector/client v0.106.1/go.mod h1:QEmOGAu/8vNn2lhwcLVI3iEUIoQlXNGWsdCfENN5qDc= -go.opentelemetry.io/collector/component v0.106.1 h1:6Xp4tKqnd/JkJDG/C4p1hto+Y5zvk5FwqZIdMCPzZlA= -go.opentelemetry.io/collector/component v0.106.1/go.mod h1:KiVE/5ZayuLlDJTe7mHqHRCn/5LrmF99C7/mKe54mWA= -go.opentelemetry.io/collector/config/configauth v0.106.1 h1:ANwKV2vzJoAcif/T23s5AIlDt8kTa8bUMcSN6fYAruQ= -go.opentelemetry.io/collector/config/configauth v0.106.1/go.mod h1:nBTtlQ2KoMnUEp1PXa6hMCwcJpJ59poUdKyDq1fO/R4= -go.opentelemetry.io/collector/config/configcompression v1.12.0 h1:RxqSDVZPJyL7I3v+gdVDvnJ/9tV0ZWgraRDX/gaddfA= -go.opentelemetry.io/collector/config/configcompression v1.12.0/go.mod h1:6+m0GKCv7JKzaumn7u80A2dLNCuYf5wdR87HWreoBO0= -go.opentelemetry.io/collector/config/confighttp v0.106.1 h1:OBX21JpJOVRASDnkwor5JpNz85qGvWYjtCIFO+5cUb8= -go.opentelemetry.io/collector/config/confighttp v0.106.1/go.mod h1:kafsg9XCdSHbgwOJO96Xxv3VolmjUN8KOozrjZzrun4= -go.opentelemetry.io/collector/config/configopaque v1.12.0 h1:aIsp9NdcLZSiG4YDoFPGXhmma03Tk+6e89+n8GtU/Mc= -go.opentelemetry.io/collector/config/configopaque v1.12.0/go.mod h1:0xURn2sOy5j4fbaocpEYfM97HPGsiffkkVudSPyTJlM= -go.opentelemetry.io/collector/config/configtelemetry v0.106.1 h1:A8nwYnI6brfur5KPFC8GtVX/49pByvVoKSgO4qPXBqg= -go.opentelemetry.io/collector/config/configtelemetry v0.106.1/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= -go.opentelemetry.io/collector/config/configtls v1.12.0 h1:Px0+GE4LE/9sXMgkwBb5g8QHWvnrnuRg9BLSa+QtxgM= -go.opentelemetry.io/collector/config/configtls v1.12.0/go.mod h1:aeCGPlvrWhc+EySpIKdelPAj4l9wXKzZPouQO3NIoTs= -go.opentelemetry.io/collector/config/internal v0.106.1 h1:cEENs6xIMi4wjGF18JZX5uTV70mHPGfHKg9XndOubBs= -go.opentelemetry.io/collector/config/internal v0.106.1/go.mod h1:cmhchMcN0o/upXM7bxGv5djhhSW8kAYjKJoqT+AOxy0= -go.opentelemetry.io/collector/confmap v0.106.1 h1:R7HQIPDRPOEwauBeJUlkT8Elc5f0KQr/s/kQfZi05t0= -go.opentelemetry.io/collector/confmap v0.106.1/go.mod h1:iWdWgvxRYSHdAt5ySgPJq/i6fQMKGNnP5Pt7jOfTXno= -go.opentelemetry.io/collector/consumer v0.106.1 h1:+AQ/Kmoc/g0WP8thwymNkXk1jeWsHDK6XyYfdezcxcc= -go.opentelemetry.io/collector/consumer v0.106.1/go.mod h1:oy6pR/v5o/N9cxsICskyt//bU8k8EG0JeOO1MTDfs5A= -go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 h1:uxQjWm2XE7d1OncQDM9tL1ha+otGt1HjoRYIcQRMOfQ= -go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1/go.mod h1:xQScBf9/PORFaYM6JVPOr7/TcRVEuKcW5XbAXfJByRs= -go.opentelemetry.io/collector/consumer/consumertest v0.106.1 h1:hDdFeVjCLIJ6iLfbiYcV9s+4iboFXbkJ/k3h09qusPw= -go.opentelemetry.io/collector/consumer/consumertest v0.106.1/go.mod h1:WRTYnQ8bYHQrEN6eJZ80oC4pNI7VeDRdsTZI6xs9o5M= -go.opentelemetry.io/collector/extension v0.106.1 h1:HNV2eOxaSDy5gL5KYoPoTLlp6fdeWmuw4paxhi10VUo= -go.opentelemetry.io/collector/extension v0.106.1/go.mod h1:DCOGxD+WnIJiDveKWlvH5WwB9AgqlRUlnKgwhNCLrtQ= -go.opentelemetry.io/collector/extension/auth v0.106.1 h1:IJyY5zeC11H/jlEGVx2bfTW0oVui2k1AjV8DnC6tYhE= -go.opentelemetry.io/collector/extension/auth v0.106.1/go.mod h1:4VcPLz6QTNq3fbY6kH5tvTnF6tWtz4toK2LC1ydpnts= -go.opentelemetry.io/collector/featuregate v1.12.0 h1:l5WbV2vMQd2bL8ubfGrbKNtZaeJRckE12CTHvRe47Tw= -go.opentelemetry.io/collector/featuregate v1.12.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= -go.opentelemetry.io/collector/internal/globalgates v0.106.1 h1:0NQHTcykmYNDsNKObJ2XocGCv3WUAQZppfP3o6hZUIA= -go.opentelemetry.io/collector/internal/globalgates v0.106.1/go.mod h1:Z5US6O2xkZAtxVSSBnHAPFZwPhFoxlyKLUvS67Vx4gc= -go.opentelemetry.io/collector/pdata v1.13.0 h1:eV3NQt2f1UcaibkziMvGTQI34LlpiYBUGp1yP0G/Cxw= -go.opentelemetry.io/collector/pdata v1.13.0/go.mod h1:MYeB0MmMAxeM0hstCFrCqWLzdyeYySim2dG6pDT6nYI= -go.opentelemetry.io/collector/pdata/pprofile v0.106.1 h1:nOLo25YnluNi+zAbU7G24RN86cJ1/EZJc6VEayBlOPo= -go.opentelemetry.io/collector/pdata/pprofile v0.106.1/go.mod h1:chr7lMJIzyXkccnPRkIPhyXtqLZLSReZYhwsggOGEfg= -go.opentelemetry.io/collector/pdata/testdata v0.106.1 h1:JUyLAwKD8o/9jgkBi16zOClxOyY028A7XIXHPV4mNmM= -go.opentelemetry.io/collector/pdata/testdata v0.106.1/go.mod h1:ghdz2RDEzsfigW0J+9oqA4fGmQJ/DJYUhE3vYU6JfhM= +go.opentelemetry.io/collector v0.107.0 h1:C1Mng03iE73flGhEg795IFVlr3qhDLef5GESjIVtx5g= +go.opentelemetry.io/collector v0.107.0/go.mod h1:7xDYvzBb3Ez6qFQl0IArBbmNNazIxZMVoRkbgJYRjyg= +go.opentelemetry.io/collector/client v1.13.0 h1:I0GzZPcOG+F6BY46SgsdcpCN+L0xPfjzTRN2Y4Etdrw= +go.opentelemetry.io/collector/client v1.13.0/go.mod h1:GOE/UvRdklwPCqYLRUOSiU/syl1BGQWa48ex7OGOq9Y= +go.opentelemetry.io/collector/component v0.107.0 h1:3ReaEAtKwrPj7HrlKjEGBDKbBaxdRMPC2mfZ9b6zjXE= +go.opentelemetry.io/collector/component v0.107.0/go.mod h1:1xMIYKvpnP7laipjgEw7kq1ozG7ySLkA0Evhr2Bp8M4= +go.opentelemetry.io/collector/config/configauth v0.107.0 h1:2rAoMJjSfdP+ao5i7Ku68QYW5p0jjZ9y6a0nj3cIFp0= +go.opentelemetry.io/collector/config/configauth v0.107.0/go.mod h1:IQx5BBZRoyPX9Qr3W4Ajy/4AnyJZb6jylI4rITrZMHQ= +go.opentelemetry.io/collector/config/configcompression v1.13.0 h1:2LApl3qDZgjsVblY1Qu0gJaw9ZyYnZ6ZDUvid9rCZVg= +go.opentelemetry.io/collector/config/configcompression v1.13.0/go.mod h1:6+m0GKCv7JKzaumn7u80A2dLNCuYf5wdR87HWreoBO0= +go.opentelemetry.io/collector/config/confighttp v0.107.0 h1:HnfFg/n3xu+XH7onWrFZl8jBrVVUCe+updh3ANUB3w8= +go.opentelemetry.io/collector/config/confighttp v0.107.0/go.mod h1:/slm41hcfOwAxv8ZcGCKHC22jnQZ71z42OSWChKuIgU= +go.opentelemetry.io/collector/config/configopaque v1.13.0 h1:EDB9JIifmBth1z9IsEduoE1bT1Q8jV0sR005EMW7q1w= +go.opentelemetry.io/collector/config/configopaque v1.13.0/go.mod h1:0xURn2sOy5j4fbaocpEYfM97HPGsiffkkVudSPyTJlM= +go.opentelemetry.io/collector/config/configtelemetry v0.107.0 h1:pSGd4FWQ/Up/Af+XZTR8JNneH/wmQ/TAU4Z16JHQeUc= +go.opentelemetry.io/collector/config/configtelemetry v0.107.0/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= +go.opentelemetry.io/collector/config/configtls v1.13.0 h1:N57vOibMIPX9YZq4ZLFjj5ZjUHMYW7bpkPkygU3vt8w= +go.opentelemetry.io/collector/config/configtls v1.13.0/go.mod h1:3CBJYFQYTCYIPJMRvzn3NVtasv8out21ZNXkSCPepuY= +go.opentelemetry.io/collector/config/internal v0.107.0 h1:aENT1bVin8HCHZuKXc8U1sTYalzl6+RpOMDWpt+VoCQ= +go.opentelemetry.io/collector/config/internal v0.107.0/go.mod h1:2LQPVQPDeIyXN6AXazlls1M0zmlhIM7q80V4K7mQ6PM= +go.opentelemetry.io/collector/confmap v0.107.0 h1:M2o7jvQM9bnMU3pE2N6BK4KHYtSnvsSZkegUD89y8BU= +go.opentelemetry.io/collector/confmap v0.107.0/go.mod h1:9Fs/ZEIeiMa38VqkqIpn+JKQkcPf/lhAKA9fHu6c9GY= +go.opentelemetry.io/collector/consumer v0.107.0 h1:fF/+xyv9BfXQUvuJqkljrpzKyBQExDQt6zB5rzGyuHs= +go.opentelemetry.io/collector/consumer v0.107.0/go.mod h1:wgWpFes9sbnZ11XeJPSeutU8GJx6dT/gzSUqHpaZZQA= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 h1:SEP5rLm4KgBaELciRQO4m9U2q3xn16KGjpIw8zQn6Ik= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0/go.mod h1:Vi/aqlZjCBdGgGu+iOEfUyHvq2TJBar0WfsQSOMhR6Y= +go.opentelemetry.io/collector/consumer/consumertest v0.107.0 h1:BfjFHHAqbTmCN32akYvMhWKYC+ayHTX935/fRChwohM= +go.opentelemetry.io/collector/consumer/consumertest v0.107.0/go.mod h1:qNMedscdVyuxbV+wWUt4yGKQM3c0YEgQJTFeAtGZjRY= +go.opentelemetry.io/collector/extension v0.107.0 h1:wstZXb24RwdcchZu3juTH9M0xryKG4sYmb1/w6J3tqQ= +go.opentelemetry.io/collector/extension v0.107.0/go.mod h1:w/+HXzRO7jPutUIMyBlzX6deUPl205QCEwteB0YgWOg= +go.opentelemetry.io/collector/extension/auth v0.107.0 h1:xv+MI9ce8RG1UP4XihTaPR3pCKVvKOl2iIyFqYa0bvE= +go.opentelemetry.io/collector/extension/auth v0.107.0/go.mod h1:tFMzaKaUAx3eWpp3lOLZ8OcLbryydyof9+GCvCWmKmU= +go.opentelemetry.io/collector/featuregate v1.13.0 h1:rc84eCf5hesXQ8/bP6Zc15wqthbomfLBHmox5tT7AwM= +go.opentelemetry.io/collector/featuregate v1.13.0/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= +go.opentelemetry.io/collector/internal/globalgates v0.107.0 h1:PaD6WgQg80YTVxg8OF+YEqgI7WRd13wMu/R6GIG7uNU= +go.opentelemetry.io/collector/internal/globalgates v0.107.0/go.mod h1:hca7Tpzu6JmBrAOgmlyp/ZM6kxprPRMKqSYoq/Tdzjw= +go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02 h1:ZWKffCXPwEjYkfoDPCVLHEBdHrFyD/ZcMc4nbCmYkFU= +go.opentelemetry.io/collector/pdata v1.13.1-0.20240816132030-9fd84668bb02/go.mod h1:z1dTjwwtcoXxZx2/nkHysjxMeaxe9pEmYTEr4SMNIx8= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0 h1:F25VZrEkSaneIBNcNI9LEBWf9nRC/WHKluSBTP0gKAA= +go.opentelemetry.io/collector/pdata/pprofile v0.107.0/go.mod h1:1GrwsKtgogRCt8aG/0lfJ037yDdFtYqF+OtJr+snxRQ= +go.opentelemetry.io/collector/pdata/testdata v0.107.0 h1:02CqvJrYjkrBlWDD+6yrByN1AhG2zT61OScLPhyyMwU= +go.opentelemetry.io/collector/pdata/testdata v0.107.0/go.mod h1:bqaeiDH1Lc5DFJXvjVHwO50x00TXj+oFre+EbOVeZXs= go.opentelemetry.io/collector/receiver v0.106.1 h1:9kDLDJmInnz+AzAV9oV/UGMoc1+oI1pwMMs7+uMiJq4= go.opentelemetry.io/collector/receiver v0.106.1/go.mod h1:3j9asWz7mqsgE77rPaNhlNQhRwgFhRynf0UEPs/4rkM= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= @@ -192,9 +192,9 @@ golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -218,8 +218,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -240,15 +240,15 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -257,8 +257,9 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/receiver/huaweicloudcesreceiver/integration_test.go b/receiver/huaweicloudcesreceiver/integration_test.go index 5ce8325b5072..f9d622af2c28 100644 --- a/receiver/huaweicloudcesreceiver/integration_test.go +++ b/receiver/huaweicloudcesreceiver/integration_test.go @@ -20,7 +20,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/pmetrictest" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver/mocks" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver/internal/mocks" ) func TestHuaweiCloudCESReceiverIntegration(t *testing.T) { diff --git a/receiver/huaweicloudcesreceiver/internal/ces_client.go b/receiver/huaweicloudcesreceiver/internal/ces_client.go index 9a0ca8e95c63..dc44ff830ffc 100644 --- a/receiver/huaweicloudcesreceiver/internal/ces_client.go +++ b/receiver/huaweicloudcesreceiver/internal/ces_client.go @@ -8,7 +8,10 @@ import ( "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ces/v1/model" ) -//go:generate mockery --name CesClient --case=underscore --output=../mocks +// This interface should have all the function defined inside https://github.com/huaweicloud/huaweicloud-sdk-go-v3/blob/v0.1.110/services/ces/v1/ces_client.go +// Check https://github.com/vektra/mockery on how to install it on your machine. +// +//go:generate mockery --name CesClient --case=underscore --output=./mocks type CesClient interface { BatchListMetricData(request *model.BatchListMetricDataRequest) (*model.BatchListMetricDataResponse, error) BatchListMetricDataInvoker(request *model.BatchListMetricDataRequest) *ces.BatchListMetricDataInvoker diff --git a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go index ef312980f62c..aafb1339283d 100644 --- a/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go +++ b/receiver/huaweicloudcesreceiver/internal/ces_to_otlp_test.go @@ -13,63 +13,6 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" ) -func stringPtr(s string) *string { - return &s -} - -func float64Ptr(f float64) *float64 { - return &f -} - -func expectedMetrics() pmetric.Metrics { - metrics := pmetric.NewMetrics() - resourceMetric := metrics.ResourceMetrics().AppendEmpty() - - resource := resourceMetric.Resource() - resource.Attributes().PutStr("cloud.provider", "huawei_cloud") - resource.Attributes().PutStr("project.id", "project_1") - resource.Attributes().PutStr("region", "eu-west-101") - - scopedMetric := resourceMetric.ScopeMetrics().AppendEmpty() - scopedMetric.Scope().SetName("huawei_cloud_ces") - scopedMetric.Scope().SetVersion("v1") - - metric := scopedMetric.Metrics().AppendEmpty() - metric.SetName("cpu_util") - metric.SetUnit("%") - metric.Metadata().PutStr("instance_id", "faea5b75-e390-4e2b-8733-9226a9026070") - metric.Metadata().PutStr("service.namespace", "SYS.ECS") - - dataPoints := metric.SetEmptyGauge().DataPoints() - dp := dataPoints.AppendEmpty() - dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625610000))) - dp.SetDoubleValue(0.5) - - dp = dataPoints.AppendEmpty() - dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625715000))) - dp.SetDoubleValue(0.7) - - scopedMetric = resourceMetric.ScopeMetrics().AppendEmpty() - scopedMetric.Scope().SetName("huawei_cloud_ces") - scopedMetric.Scope().SetVersion("v1") - - metric = scopedMetric.Metrics().AppendEmpty() - metric.SetName("network_vm_connections") - metric.SetUnit("count") - metric.Metadata().PutStr("instance_id", "06b4020f-461a-4a52-84da-53fa71c2f42b") - metric.Metadata().PutStr("service.namespace", "SYS.ECS") - - dataPoints = metric.SetEmptyGauge().DataPoints() - dp = dataPoints.AppendEmpty() - dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625612000))) - dp.SetDoubleValue(1) - - dp = dataPoints.AppendEmpty() - dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625717000))) - dp.SetDoubleValue(3) - return metrics -} - func TestConvertCESMetricsToOTLP(t *testing.T) { tests := []struct { name string @@ -137,3 +80,60 @@ func TestConvertCESMetricsToOTLP(t *testing.T) { }) } } + +func stringPtr(s string) *string { + return &s +} + +func float64Ptr(f float64) *float64 { + return &f +} + +func expectedMetrics() pmetric.Metrics { + metrics := pmetric.NewMetrics() + resourceMetric := metrics.ResourceMetrics().AppendEmpty() + + resource := resourceMetric.Resource() + resource.Attributes().PutStr("cloud.provider", "huawei_cloud") + resource.Attributes().PutStr("project.id", "project_1") + resource.Attributes().PutStr("region", "eu-west-101") + + scopedMetric := resourceMetric.ScopeMetrics().AppendEmpty() + scopedMetric.Scope().SetName("huawei_cloud_ces") + scopedMetric.Scope().SetVersion("v1") + + metric := scopedMetric.Metrics().AppendEmpty() + metric.SetName("cpu_util") + metric.SetUnit("%") + metric.Metadata().PutStr("instance_id", "faea5b75-e390-4e2b-8733-9226a9026070") + metric.Metadata().PutStr("service.namespace", "SYS.ECS") + + dataPoints := metric.SetEmptyGauge().DataPoints() + dp := dataPoints.AppendEmpty() + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625610000))) + dp.SetDoubleValue(0.5) + + dp = dataPoints.AppendEmpty() + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625715000))) + dp.SetDoubleValue(0.7) + + scopedMetric = resourceMetric.ScopeMetrics().AppendEmpty() + scopedMetric.Scope().SetName("huawei_cloud_ces") + scopedMetric.Scope().SetVersion("v1") + + metric = scopedMetric.Metrics().AppendEmpty() + metric.SetName("network_vm_connections") + metric.SetUnit("count") + metric.Metadata().PutStr("instance_id", "06b4020f-461a-4a52-84da-53fa71c2f42b") + metric.Metadata().PutStr("service.namespace", "SYS.ECS") + + dataPoints = metric.SetEmptyGauge().DataPoints() + dp = dataPoints.AppendEmpty() + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625612000))) + dp.SetDoubleValue(1) + + dp = dataPoints.AppendEmpty() + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.UnixMilli(1556625717000))) + dp.SetDoubleValue(3) + return metrics +} diff --git a/receiver/huaweicloudcesreceiver/mocks/ces_client.go b/receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go similarity index 100% rename from receiver/huaweicloudcesreceiver/mocks/ces_client.go rename to receiver/huaweicloudcesreceiver/internal/mocks/ces_client.go diff --git a/receiver/huaweicloudcesreceiver/receiver_test.go b/receiver/huaweicloudcesreceiver/receiver_test.go index 786e47a06386..602ee20f3f83 100644 --- a/receiver/huaweicloudcesreceiver/receiver_test.go +++ b/receiver/huaweicloudcesreceiver/receiver_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver/mocks" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver/internal/mocks" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/receiver/receivertest"