This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preliminary refactor for supporting spans over HTTP
This include changes in `Reporter` and `RemoteControlledSampler` init methods. `Reporter` now delegate span sending to new `Sender` classes . Signed-off-by: vitto <vittorio.camisa@gmail.com>
- Loading branch information
Showing
9 changed files
with
118 additions
and
51 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
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
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,65 @@ | ||
# Copyright (c) 2016 Uber Technologies, Inc. | ||
# | ||
# 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. | ||
|
||
import logging | ||
|
||
from .local_agent_net import LocalAgentSender | ||
|
||
from jaeger_client.thrift_gen.agent import Agent | ||
|
||
|
||
logger = logging.getLogger('jaeger_tracing') | ||
|
||
|
||
class Sender(object): | ||
def __init__(self, host, port, io_loop): | ||
self.host = host | ||
self.port = port | ||
self.io_loop = io_loop | ||
|
||
def send(self, batch): | ||
raise NotImplementedError('This method should be implemented by subclasses') | ||
|
||
|
||
class UDPSender(Sender): | ||
def __init__(self, host, port, io_loop): | ||
super(UDPSender, self).__init__( | ||
host=host, | ||
port=port, | ||
io_loop=io_loop | ||
) | ||
self.channel = self._create_local_agent_channel() | ||
self.agent = Agent.Client(self.channel, self) | ||
|
||
def send(self, batch): | ||
""" | ||
Send batch of spans out via thrift transport. Any exceptions thrown | ||
will be caught above in the exception handler of _submit(). | ||
""" | ||
return self.agent.emitBatch(batch) | ||
|
||
def _create_local_agent_channel(self): | ||
""" | ||
Create an out-of-process channel communicating to local jaeger-agent. | ||
Spans are submitted as SOCK_DGRAM Thrift, sampling strategy is polled | ||
via JSON HTTP. | ||
:param self: instance of Config | ||
""" | ||
logger.info('Initializing Jaeger Tracer with UDP reporter') | ||
return LocalAgentSender( | ||
host=self.host, | ||
reporting_port=self.port, | ||
io_loop=self.io_loop | ||
) |
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