Skip to content

Commit 81651ad

Browse files
committed
add CreateMetricStore
1 parent 14bb326 commit 81651ad

4 files changed

+10
-10
lines changed

client_interface.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ type ClientInterface interface {
9696

9797
// #################### MetricStore Operations #####################
9898
// CreateMetricStore creates a new metric store in SLS.
99-
CreateMetricStore(project string, metricStore LogStore) error
99+
CreateMetricStore(project string, metricStore *LogStore) error
100100
// UpdateMetricStore updates a metric store.
101-
UpdateMetricStore(project string, metricStore LogStore) error
101+
UpdateMetricStore(project string, metricStore *LogStore) error
102102
// DeleteMetricStore deletes a metric store.
103103
DeleteMetricStore(project, name string) error
104104
// GetMetricStore return a metric store.

client_metric_store.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package sls
33
import "time"
44

55
// CreateMetricStore .
6-
func (c *Client) CreateMetricStore(project string, metricStore LogStore) error {
6+
func (c *Client) CreateMetricStore(project string, metricStore *LogStore) error {
77
metricStore.TelemetryType = "Metrics"
8-
err := c.CreateLogStoreV2(project, &metricStore)
8+
err := c.CreateLogStoreV2(project, metricStore)
99
if err != nil {
1010
return err
1111
}
@@ -35,9 +35,9 @@ func (c *Client) CreateMetricStore(project string, metricStore LogStore) error {
3535
}
3636

3737
// UpdateMetricStore .
38-
func (c *Client) UpdateMetricStore(project string, metricStore LogStore) error {
38+
func (c *Client) UpdateMetricStore(project string, metricStore *LogStore) error {
3939
metricStore.TelemetryType = "Metrics"
40-
err := c.UpdateLogStoreV2(project, &metricStore)
40+
err := c.UpdateLogStoreV2(project, metricStore)
4141
if err != nil {
4242
return err
4343
}

client_metric_store_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (m *MetricStoreTestSuite) TearDownSuite() {
4949
}
5050

5151
func (m *MetricStoreTestSuite) TestClient_CreateAndDeleteMetricStore() {
52-
metricStore := LogStore{
52+
metricStore := &LogStore{
5353
Name: m.metricStoreName,
5454
TTL: m.ttl,
5555
ShardCount: m.shardCnt,
@@ -61,7 +61,7 @@ func (m *MetricStoreTestSuite) TestClient_CreateAndDeleteMetricStore() {
6161
}
6262

6363
func (m *MetricStoreTestSuite) TestClient_UpdateAndGetMetricStore() {
64-
metricStore1 := LogStore{
64+
metricStore1 := &LogStore{
6565
Name: m.metricStoreName,
6666
TTL: m.ttl,
6767
ShardCount: m.shardCnt,

token_auto_update_client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ func (c *TokenAutoUpdateClient) DeleteExport(project string, name string) (err e
15491549
}
15501550
return
15511551
}
1552-
func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore LogStore) (err error) {
1552+
func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore *LogStore) (err error) {
15531553
for i := 0; i < c.maxTryTimes; i++ {
15541554
err = c.logClient.CreateMetricStore(project, metricStore)
15551555
if !c.processError(err) {
@@ -1558,7 +1558,7 @@ func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore Lo
15581558
}
15591559
return
15601560
}
1561-
func (c *TokenAutoUpdateClient) UpdateMetricStore(project string, metricStore LogStore) (err error) {
1561+
func (c *TokenAutoUpdateClient) UpdateMetricStore(project string, metricStore *LogStore) (err error) {
15621562
for i := 0; i < c.maxTryTimes; i++ {
15631563
err = c.logClient.UpdateMetricStore(project, metricStore)
15641564
if !c.processError(err) {

0 commit comments

Comments
 (0)