Skip to content

Commit

Permalink
add CreateMetricStore
Browse files Browse the repository at this point in the history
  • Loading branch information
chaolee50 committed Jun 20, 2022
1 parent 14bb326 commit 81651ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions client_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ type ClientInterface interface {

// #################### MetricStore Operations #####################
// CreateMetricStore creates a new metric store in SLS.
CreateMetricStore(project string, metricStore LogStore) error
CreateMetricStore(project string, metricStore *LogStore) error
// UpdateMetricStore updates a metric store.
UpdateMetricStore(project string, metricStore LogStore) error
UpdateMetricStore(project string, metricStore *LogStore) error
// DeleteMetricStore deletes a metric store.
DeleteMetricStore(project, name string) error
// GetMetricStore return a metric store.
Expand Down
8 changes: 4 additions & 4 deletions client_metric_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package sls
import "time"

// CreateMetricStore .
func (c *Client) CreateMetricStore(project string, metricStore LogStore) error {
func (c *Client) CreateMetricStore(project string, metricStore *LogStore) error {
metricStore.TelemetryType = "Metrics"
err := c.CreateLogStoreV2(project, &metricStore)
err := c.CreateLogStoreV2(project, metricStore)
if err != nil {
return err
}
Expand Down Expand Up @@ -35,9 +35,9 @@ func (c *Client) CreateMetricStore(project string, metricStore LogStore) error {
}

// UpdateMetricStore .
func (c *Client) UpdateMetricStore(project string, metricStore LogStore) error {
func (c *Client) UpdateMetricStore(project string, metricStore *LogStore) error {
metricStore.TelemetryType = "Metrics"
err := c.UpdateLogStoreV2(project, &metricStore)
err := c.UpdateLogStoreV2(project, metricStore)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions client_metric_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (m *MetricStoreTestSuite) TearDownSuite() {
}

func (m *MetricStoreTestSuite) TestClient_CreateAndDeleteMetricStore() {
metricStore := LogStore{
metricStore := &LogStore{
Name: m.metricStoreName,
TTL: m.ttl,
ShardCount: m.shardCnt,
Expand All @@ -61,7 +61,7 @@ func (m *MetricStoreTestSuite) TestClient_CreateAndDeleteMetricStore() {
}

func (m *MetricStoreTestSuite) TestClient_UpdateAndGetMetricStore() {
metricStore1 := LogStore{
metricStore1 := &LogStore{
Name: m.metricStoreName,
TTL: m.ttl,
ShardCount: m.shardCnt,
Expand Down
4 changes: 2 additions & 2 deletions token_auto_update_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ func (c *TokenAutoUpdateClient) DeleteExport(project string, name string) (err e
}
return
}
func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore LogStore) (err error) {
func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore *LogStore) (err error) {
for i := 0; i < c.maxTryTimes; i++ {
err = c.logClient.CreateMetricStore(project, metricStore)
if !c.processError(err) {
Expand All @@ -1558,7 +1558,7 @@ func (c *TokenAutoUpdateClient) CreateMetricStore(project string, metricStore Lo
}
return
}
func (c *TokenAutoUpdateClient) UpdateMetricStore(project string, metricStore LogStore) (err error) {
func (c *TokenAutoUpdateClient) UpdateMetricStore(project string, metricStore *LogStore) (err error) {
for i := 0; i < c.maxTryTimes; i++ {
err = c.logClient.UpdateMetricStore(project, metricStore)
if !c.processError(err) {
Expand Down

0 comments on commit 81651ad

Please sign in to comment.