Exemple #1
0
    def __init__(self, network='host', telemetry=True):
        # This will hole a cumulative count of the bugs found over the course of the job.
        self.bugs = []
        self.status = []
        self.appinsights_instrumentation_key = '9d67f59d-4f44-475c-9363-d0ae7ea61e95'
        self.telemetry = telemetry

        self.network = network
        self.work_directory = work_directory
        self.tools, self.tool_paths =\
            init_tools(os.path.join(script_dir, 'raft-tools', 'tools'))

        self.container_utils, self.container_utils_paths =\
            init_tools(os.path.join(script_dir, 'raft-tools'))

        if not os.path.exists(self.work_directory):
            os.mkdir(self.work_directory)
        self.storage, self.secrets_path, self.events_sink =\
            init_local()

        self.source = "local"
        self.logger = logging.getLogger(__name__)
        logging.basicConfig(level=logging.INFO)
        if (telemetry):
            ai_key = 'InstrumentationKey=' + self.appinsights_instrumentation_key
            handler = AzureEventHandler(connection_string=ai_key)
            handler.add_telemetry_processor(self.telemetry_processor)
            self.logger.addHandler(handler)
Exemple #2
0
from opencensus.ext.azure import metrics_exporter
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

app_insught_intrumentation_key = '841b1abd-f5e6-499e-a744-d59a6ca8762a'
# Logging
logger = logging.getLogger(__name__)
logger.addHandler(AzureEventHandler(connection_string='InstrumentationKey='+app_insught_intrumentation_key))
logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
  enable_standard_metrics=True,
  connection_string='InstrumentationKey='+app_insught_intrumentation_key)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(
        connection_string='InstrumentationKey='+app_insught_intrumentation_key),
    sampler=ProbabilitySampler(1.0),
)

app = Flask(__name__)
Exemple #3
0
from opencensus.ext.azure.log_exporter import AzureLogHandler
from opencensus.ext.azure import metrics_exporter
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

# Logging
logger = logging.getLogger(__name__)

logger.addHandler(AzureEventHandler(
    connection_string='InstrumentationKey=ee6147a6-6162-463a-a119-bfeaff3147f6')
)

logger.addHandler(AzureLogHandler(
    connection_string='InstrumentationKey=ee6147a6-6162-463a-a119-bfeaff3147f6')
)

logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
  enable_standard_metrics=True,
  connection_string='InstrumentationKey=ee6147a6-6162-463a-a119-bfeaff3147f6')

# Tracing
tracer = Tracer(
Exemple #4
0
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.trace.samplers import ProbabilitySampler

# Logging
logger = logging.getLogger(__name__)
logger.addHandler(
    AzureLogHandler(
        connection_string=
        'InstrumentationKey=75bbbb31-b712-4e5d-abc7-8eb89689ce08;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/'
    ))

#Events
eventlogger = logging.getLogger('eventlogger')
eventlogger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=75bbbb31-b712-4e5d-abc7-8eb89689ce08;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/'
    ))
eventlogger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string=
    'InstrumentationKey=75bbbb31-b712-4e5d-abc7-8eb89689ce08;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/'
)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
        'InstrumentationKey=75bbbb31-b712-4e5d-abc7-8eb89689ce08;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/'
Exemple #5
0
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--config", type=str, help="config.yml", required=True)
    args = parser.parse_args()

    # read config
    with open(args.config) as f:
        config_params = yaml.load(f, Loader=yaml.FullLoader)

    # logger to app insights
    con_string = os.getenv('INFERENCESYSTEM_APPINSIGHTS_CONNECTION_STRING')
    logger = logging.getLogger(__name__)
    if appInsightsKey is not None:
        logger.addHandler(AzureLogHandler(connection_string=con_string))
        logger.addHandler(AzureEventHandler(connection_string=con_string))
        logger.setLevel(logging.INFO)

    ## Model Details
    model_type = config_params["model_type"]
    model_path = config_params["model_path"]
    model_local_threshold = config_params["model_local_threshold"]
    model_global_threshold = config_params["model_global_threshold"]
    # load_model_into_memory
    if model_type == "AudioSet":
        whalecall_classification_model = OrcaDetectionModel(
            model_path,
            threshold=model_local_threshold,
            min_num_positive_calls_threshold=model_global_threshold)
    elif model_type == "FastAI":
        model_name = config_params["model_name"]
Exemple #6
0
# Copyright 2019, OpenCensus Authors
#
# 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 opencensus.ext.azure.log_exporter import AzureEventHandler

logger = logging.getLogger(__name__)
# TODO: you need to specify the instrumentation key in a connection string
# and place it in the APPLICATIONINSIGHTS_CONNECTION_STRING
# environment variable.
logger.addHandler(AzureEventHandler())
logger.setLevel(logging.INFO)
logger.info('Hello, World!')
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

# Logging
logger = logging.getLogger(__name__)

logger.addHandler(
    AzureLogHandler(connection_string="InstrumentationKey=daa98b97-72b5-4a8d-9a0f-c75c61fe4883;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/")
)
logger.addHandler(
    AzureEventHandler(connection_string="InstrumentationKey=daa98b97-72b5-4a8d-9a0f-c75c61fe4883;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/")
)
logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string="InstrumentationKey=daa98b97-72b5-4a8d-9a0f-c75c61fe4883;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/"
)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(connection_string="InstrumentationKey=daa98b97-72b5-4a8d-9a0f-c75c61fe4883;IngestionEndpoint=https://westus2-1.in.applicationinsights.azure.com/"),
    sampler=ProbabilitySampler(1.0),
)
Exemple #8
0
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

from applicationinsights import TelemetryClient

INSIGHTS_CONN_STRING = "InstrumentationKey=61371d7a-1887-468d-ab9c-b62b4731fe33;IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/"

# Logging
logger = logging.getLogger(__name__)  # TODO: Setup logger
#handler = AzureLogHandler(connection_string = INSIGHTS_CONN_STRING)
logger.addHandler(AzureEventHandler(connection_string=INSIGHTS_CONN_STRING))

#logger.addHandler(handler)
logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True, connection_string=INSIGHTS_CONN_STRING)

# Tracing
tracer = tracer = TelemetryClient(INSIGHTS_CONN_STRING)

app = Flask(__name__)

# Requests
middleware = FlaskMiddleware(
Exemple #9
0
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

# Logging
logger = logging.getLogger(__name__)
logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=3386db9e-347a-43c0-921e-c84c7c757f4e'))
logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=3386db9e-347a-43c0-921e-c84c7c757f4e'
)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
        'InstrumentationKey=3386db9e-347a-43c0-921e-c84c7c757f4e'),
    sampler=ProbabilitySampler(1.0),
Exemple #10
0
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module

from opencensus.trace.tracer import Tracer
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler
instrumentationKey = "InstrumentationKey=b26caeb6-ad66-4552-8c82-a1b2337ed169;IngestionEndpoint=https://eastus2-0.in.applicationinsights.azure.com/"
# Logging
# DONE: Setup logger
logger = logging.getLogger(__name__)
logger.addHandler(AzureEventHandler(connection_string=instrumentationKey))
# logger.setLevel(logging.INFO)
logger.info('Hello, World!')
# Metrics
# DONE: Setup exporter
exporter = metrics_exporter.new_metrics_exporter(
  enable_standard_metrics=False,
  connection_string=instrumentationKey
)

# Tracing
# tracer = # DONE: Setup tracer
tracer = Tracer(
    exporter = AzureExporter(connection_string=instrumentationKey),
    sampler=ProbabilitySampler(1.0)
)
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

app = Flask(__name__)

# Requests
middleware = FlaskMiddleware(
    app,
    exporter=AzureExporter(connection_string='InstrumentationKey=631abff1-59bf-460a-8968-b620d62e520b'),
    sampler=ProbabilitySampler(rate=1.0),
)

# Logging
logger = logging.getLogger(__name__)
logger.addHandler(AzureEventHandler(connection_string='InstrumentationKey=631abff1-59bf-460a-8968-b620d62e520b'))

# Metrics TODO: Setup exporter
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=631abff1-59bf-460a-8968-b620d62e520b'
)
# Tracing
tracer = Tracer(
    exporter = AzureExporter(
        connection_string = 'InstrumentationKey=631abff1-59bf-460a-8968-b620d62e520b'),
    sampler = ProbabilitySampler(1.0),
)

# Load configurations from environment or config file
app.config.from_pyfile('config_file.cfg')
Exemple #12
0
from adapter_with_error_handler import AdapterWithErrorHandler
from flight_booking_recognizer import FlightBookingRecognizer

import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler, AzureEventHandler
from opencensus.ext.azure import metrics_exporter

CONFIG = DefaultConfig()

logger = logging.getLogger(__name__)

logger.addHandler(
    AzureLogHandler(connection_string='InstrumentationKey=' +
                    CONFIG.INSTRUMENTATION_KEY))
logger.addHandler(
    AzureEventHandler(connection_string='InstrumentationKey=' +
                      CONFIG.INSTRUMENTATION_KEY))
exporter = metrics_exporter.new_metrics_exporter(
    connection_string='InstrumentationKey=' + CONFIG.INSTRUMENTATION_KEY)

# Create adapter.
# See https://aka.ms/about-bot-adapter to learn more about how bots work.
SETTINGS = BotFrameworkAdapterSettings(CONFIG.APP_ID, CONFIG.APP_PASSWORD)

# Create MemoryStorage, UserState and ConversationState
MEMORY = MemoryStorage()
USER_STATE = UserState(MEMORY)
CONVERSATION_STATE = ConversationState(MEMORY)

# Create adapter.
# See https://aka.ms/about-bot-adapter to learn more about how bots work.
ADAPTER = AdapterWithErrorHandler(SETTINGS, CONVERSATION_STATE)
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.trace.samplers import ProbabilitySampler

# Logging
# logger = # TODO: Setup logger
logger = logging.getLogger(__name__)
#logger.addHandler(AzureLogHandler(connection_string='InstrumentationKey=177c8ebe-50b7-4300-aa6f-5202197c5991'))
logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=177c8ebe-50b7-4300-aa6f-5202197c5991'))
logger.setLevel(logging.INFO)

# Metrics
# exporter = # TODO: Setup exporter
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=177c8ebe-50b7-4300-aa6f-5202197c5991'
)

# Tracing
# tracer = # TODO: Setup tracer
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

# Logging
# TODO: Setup logger
logger = logging.getLogger(__name__)
loggerEvent = logging.getLogger(__name__)
loggerEvent.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=705f49e9-1faf-4461-9467-b0ed5e0bd64a'))
loggerEvent.setLevel(logging.WARNING)

logger.addHandler(
    AzureLogHandler(connection_string=
                    'InstrumentationKey=705f49e9-1faf-4461-9467-b0ed5e0bd64a'))
logger.setLevel(logging.WARNING)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=705f49e9-1faf-4461-9467-b0ed5e0bd64a'
)

# Tracing
Exemple #15
0
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer

# Logging
logger = logging.getLogger(__name__)
handler = AzureLogHandler(
    connection_string='InstrumentationKey=3d3e7bec-d2e0-41b6-b690-7c9cb2020fc2'
)
logger.addHandler(handler)
logger.setLevel(logging.INFO)

logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=3d3e7bec-d2e0-41b6-b690-7c9cb2020fc2'))

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=3d3e7bec-d2e0-41b6-b690-7c9cb2020fc2'
)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
        'InstrumentationKey=3d3e7bec-d2e0-41b6-b690-7c9cb2020fc2'),
    sampler=ProbabilitySampler(1.0),
)
Exemple #16
0
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

# Logging
# TODO: Setup logger
logger = logging.getLogger(__name__)

logger.addHandler(
    AzureLogHandler(connection_string=
                    'InstrumentationKey=664beceb-3223-46d7-8eb7-47f3cee4fd9d'))
logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=664beceb-3223-46d7-8eb7-47f3cee4fd9d'))
logger.setLevel(logging.INFO)
# Metrics
# TODO: Setup exporter
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=664beceb-3223-46d7-8eb7-47f3cee4fd9d'
)
# Tracing
# TODO: Setup tracer
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
        'InstrumentationKey=664beceb-3223-46d7-8eb7-47f3cee4fd9d'),
    sampler=ProbabilitySampler(1.0),
Exemple #17
0
from opencensus.stats import aggregation as aggregation_module
from opencensus.stats import measure as measure_module
from opencensus.stats import stats as stats_module
from opencensus.stats import view as view_module
from opencensus.tags import tag_map as tag_map_module
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.ext.azure.log_exporter import AzureEventHandler

# Logging
logger = logging.getLogger(__name__)
logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=15d02af3-bb8b-48ab-937e-7f84588dfce0;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/'
    ))

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string=
    'InstrumentationKey=15d02af3-bb8b-48ab-937e-7f84588dfce0;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/'
)

# Tracing
tracer = Tracer(
    exporter=AzureExporter(
        connection_string=
        'InstrumentationKey=15d02af3-bb8b-48ab-937e-7f84588dfce0;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/'
    ),
Exemple #18
0
# App Insights
from opencensus.ext.azure.log_exporter import AzureLogHandler, AzureEventHandler
from opencensus.ext.azure import metrics_exporter
from opencensus.stats import aggregation, measure, stats, view
from opencensus.tags import tag_map
from opencensus.ext.azure.trace_exporter import AzureExporter
from opencensus.trace.samplers import ProbabilitySampler
from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

# Logging
logger = logging.getLogger(__name__)
logger.addHandler(
    AzureEventHandler(
        connection_string=
        'InstrumentationKey=47f60d5b-2302-4ae8-83ba-3cdbe3b8ecac'))
logger.addHandler(
    AzureLogHandler(connection_string=
                    'InstrumentationKey=47f60d5b-2302-4ae8-83ba-3cdbe3b8ecac'))
logger.setLevel(logging.INFO)
# Metrics
exporter = metrics_exporter.new_metrics_exporter(
    enable_standard_metrics=True,
    connection_string='InstrumentationKey=47f60d5b-2302-4ae8-83ba-3cdbe3b8ecac'
)

# Tracing
tracer = Tracer(exporter=AzureExporter(
    connection_string='InstrumentationKey=47f60d5b-2302-4ae8-83ba-3cdbe3b8ecac'
),