def __init__(self, host, port=2878, distribution_port=None,
              source='wavefront-pyformance', registry=None,
              reporting_interval=60, clock=None, prefix='proxy.',
              tags=None, enable_runtime_metrics=False):
     """Run parent __init__ and do proxy reporter specific setup."""
     super(WavefrontProxyReporter, self).__init__(
         source=source, registry=registry,
         reporting_interval=reporting_interval, clock=clock, prefix=prefix,
         tags=tags, enable_runtime_metrics=enable_runtime_metrics)
     self.wavefront_client = wavefront_sdk.WavefrontProxyClient(
         host=host, metrics_port=port, distribution_port=distribution_port,
         tracing_port=None)
Exemple #2
0
    #print('Au moins une des variables d environnement Wavefront n est pas definie')
    # Pas besoin de logguer car c est deja fait dans getTrafficData.php
    sys.exit(0)

else:
    #print('Les deux variables Wavefront existent')

    # Define tags
    application_tag = wavefront_sdk.common.ApplicationTags(application='TITO',
                                                           service='journey')
    global_tags = [('Showroom', 'France'), ('Home_Address', Home_Address),
                   ('Work_Address', Work_Address)]

    # Create Wavefront Span Reporter using Wavefront Proxy Client.
    proxy_client = wavefront_sdk.WavefrontProxyClient(host=proxy_name,
                                                      metrics_port=proxy_port,
                                                      distribution_port=40000,
                                                      tracing_port=30000)

    proxy_reporter = WavefrontSpanReporter(client=proxy_client, source=myhost)

    # CompositeReporter takes a list of other reporters and invokes them one by one
    # Use ConsoleReporter to output span data to console
    #composite_reporter = CompositeReporter(proxy_reporter, ConsoleReporter())
    #composite_reporter = CompositeReporter(ConsoleReporter())
    composite_reporter = CompositeReporter(proxy_reporter)

    tracer = WavefrontTracer(reporter=composite_reporter,
                             application_tags=application_tag)

    # Create span1, return a newly started and activated Scope.
    scope = tracer.start_active_span(operation_name='journeyRequest',
# get hostname
myhost = os.uname()[1]
#print('hote  : ' +myhost)

#fichier = open("/var/www/html/script2.log", "a")
#message = 'timeBefore: ' +timeBefore +'  et   timeAfter: ' +timeAfter +'   =>   timeDelta=' +str(timeDelta)
#fichier.write(message)
#fichier.close()

application_tag = wavefront_sdk.common.ApplicationTags(application='TITO',
                                                       service='journey')

# Create Wavefront Span Reporter using Wavefront Proxy Client.
proxy_client = wavefront_sdk.WavefrontProxyClient(host='localhost',
                                                  metrics_port=2878,
                                                  distribution_port=40000,
                                                  tracing_port=30000)

proxy_reporter = WavefrontSpanReporter(client=proxy_client, source=myhost)

# CompositeReporter takes a list of other reporters and invokes them one by one
# Use ConsoleReporter to output span data to console
#composite_reporter = CompositeReporter(proxy_reporter, ConsoleReporter())
#composite_reporter = CompositeReporter(ConsoleReporter())
composite_reporter = CompositeReporter(proxy_reporter)

tracer = WavefrontTracer(reporter=composite_reporter,
                         application_tags=application_tag)

# Create span1, return a newly started and activated Scope.
global_tags = [('Showroom', 'France')]
Exemple #4
0
from wavefront_opentracing_sdk import WavefrontTracer
from wavefront_opentracing_sdk.reporting import CompositeReporter
from wavefront_opentracing_sdk.reporting import ConsoleReporter
from wavefront_opentracing_sdk.reporting import WavefrontSpanReporter
import wavefront_sdk


application_tag = wavefront_sdk.common.ApplicationTags(application='ALEXapp',service='ALEXsvc')
    

# Create Wavefront Span Reporter using Wavefront Proxy Client.

proxy_client = wavefront_sdk.WavefrontProxyClient(
        host='localhost',
        metrics_port=2878,
        distribution_port=40000,
        tracing_port=30000
        # internal_flush=2  not working 
)

proxy_reporter = WavefrontSpanReporter(client=proxy_client, source='ALEXH_tracing-example')

# Create Composite reporter.
# Create Tracer with Composite Reporter.
# CompositeReporter takes a list of other reporters and invokes them one by one
# Use ConsoleReporter to output span data to console
composite_reporter = CompositeReporter(proxy_reporter, ConsoleReporter())   



tracer = WavefrontTracer(reporter=composite_reporter, application_tags=application_tag)
# pylint: disable=invalid-name
if __name__ == '__main__':
    application_tag = wavefront_sdk.common.ApplicationTags(
        application='example_app', service='example_server')
    # Create Wavefront Span Reporter using Wavefront Direct Client.
    direct_client = wavefront_sdk.WavefrontDirectClient(
        server='<SERVER_ADDR>',
        token='<TOKEN>',
        max_queue_size=50000,
        batch_size=10000,
        flush_interval_seconds=5)
    direct_reporter = WavefrontSpanReporter(direct_client)

    # Create Wavefront Span Reporter using Wavefront Proxy Client.
    proxy_client = wavefront_sdk.WavefrontProxyClient(host='<PROXY_HOST>',
                                                      tracing_port=30000,
                                                      distribution_port=40000,
                                                      metrics_port=2878)
    proxy_reporter = WavefrontSpanReporter(proxy_client)

    # Create Composite reporter.
    # Use ConsoleReporter to output span data to console.
    composite_reporter = CompositeReporter(proxy_reporter, direct_reporter,
                                           ConsoleReporter())

    # Create Tracer with Composite Reporter.
    tracer = WavefrontTracer(reporter=composite_reporter,
                             application_tags=application_tag)

    global_tags = [('global_key', 'global_val')]

    # Create span1, return a newly started and activated Scope.