Documentation
¶
Overview ¶
* Copyright 2017-2018 IBM 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.
* Copyright 2017-2018 IBM 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.
* Copyright 2017-2018 IBM 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.
* Copyright 2017-2018 IBM 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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var JobQueue chan JobRequest
JobQueue will hold all incoming data as a queue
var WorkerPool chan chan JobRequest
Functions ¶
func HandleInstances ¶
func HandleInstances(insts []*metric.InstanceMsg)
HandleInstances extracts telemetry data from incoming request from mixer and put it into the global queue
func SendHttpRequest ¶
SendHttpRequest initialize an HTTP client and call NewRelic REST API
func StartDispatcher ¶
func StartDispatcher(maxWorkers int)
Types ¶
type JobRequest ¶
type JobRequest struct {
PayLoad []*metric.InstanceMsg
}
JobRequest presents the struct of payload that contains telemetry data come from mixer and insert Insight Event through NewRelic REST API
type NewRelicGrpcAdapter ¶
type NewRelicGrpcAdapter struct {
// contains filtered or unexported fields
}
NewRelicGrpcAdapter supports metric template.
func (*NewRelicGrpcAdapter) Addr ¶
func (s *NewRelicGrpcAdapter) Addr() string
Addr returns the listening address of the server
func (*NewRelicGrpcAdapter) Close ¶
func (s *NewRelicGrpcAdapter) Close() error
Close gracefully shuts down the server; used for testing
func (*NewRelicGrpcAdapter) HandleMetric ¶
func (s *NewRelicGrpcAdapter) HandleMetric(_ context.Context, r *metric.HandleMetricRequest) (*v1beta1.ReportResult, error)
HandleMetric records metric entries
func (*NewRelicGrpcAdapter) Run ¶
func (s *NewRelicGrpcAdapter) Run(shutdown chan error)
Run starts the server run
type Server ¶
Server is basic server interface
func NewGrpcAdapter ¶
NewGrpcAdapter creates a new gRPC adapter that listens at provided port.
type Worker ¶
type Worker struct { ID int Job chan JobRequest WorkerPool chan chan JobRequest QuitChan chan bool }
Worker represents the object which would retrieve Job, extract payload
func NewWorker ¶
func NewWorker(id int, jobQueue chan chan JobRequest) Worker
NewWorker creates a new Worker and regist it into the available worker pool