This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated Go RPC code from other code:
- Identified code used by GoRPC plugins - Created files with deprecated flags to hold code that is used by GoRPC plugins - Added deprecation warning when loading legacy plugin
- Loading branch information
Showing
16 changed files
with
1,018 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
control/plugin/collector.go → control/plugin/collector_deprecated.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* ** DEPRECATED ** | ||
For more information, see our deprecation notice | ||
on Github: https://github.com/intelsdi-x/snap/issues/1289 | ||
*/ | ||
|
||
/* | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Copyright 2015 Intel Corporation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package plugin | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/intelsdi-x/snap/core/cdata" | ||
) | ||
|
||
type collectorPluginProxy struct { | ||
Plugin CollectorPlugin | ||
Session Session | ||
} | ||
|
||
func (c *collectorPluginProxy) GetMetricTypes(args []byte, reply *[]byte) error { | ||
defer catchPluginPanic(c.Session.Logger()) | ||
|
||
c.Session.Logger().Debugln("GetMetricTypes called") | ||
// Reset heartbeat | ||
c.Session.ResetHeartbeat() | ||
|
||
dargs := &GetMetricTypesArgs{PluginConfig: ConfigType{ConfigDataNode: cdata.NewNode()}} | ||
c.Session.Decode(args, dargs) | ||
|
||
mts, err := c.Plugin.GetMetricTypes(dargs.PluginConfig) | ||
if err != nil { | ||
return errors.New(fmt.Sprintf("GetMetricTypes call error : %s", err.Error())) | ||
} | ||
|
||
r := GetMetricTypesReply{MetricTypes: mts} | ||
*reply, err = c.Session.Encode(r) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (c *collectorPluginProxy) CollectMetrics(args []byte, reply *[]byte) error { | ||
defer catchPluginPanic(c.Session.Logger()) | ||
c.Session.Logger().Debugln("CollectMetrics called") | ||
// Reset heartbeat | ||
c.Session.ResetHeartbeat() | ||
|
||
dargs := &CollectMetricsArgs{} | ||
c.Session.Decode(args, dargs) | ||
|
||
ms, err := c.Plugin.CollectMetrics(dargs.MetricTypes) | ||
if err != nil { | ||
return errors.New(fmt.Sprintf("CollectMetrics call error : %s", err.Error())) | ||
} | ||
|
||
r := CollectMetricsReply{PluginMetrics: ms} | ||
*reply, err = c.Session.Encode(r) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.