Skip to content

Commit

Permalink
update instrumentation key
Browse files Browse the repository at this point in the history
  • Loading branch information
KhanhNQ79 authored and KhanhNQ79 committed Aug 10, 2024
1 parent 56a4c0c commit 224df52
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions azure-vote/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@
config_integration.trace_integrations(['requests'])
# Standard Logging
logger = logging.getLogger(__name__)
handler = AzureLogHandler(connection_string='InstrumentationKey=7e65a2c3-807f-4cc1-a93c-2911ce392a47;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/;ApplicationId=586b6e93-e5d3-4ec7-82e7-1a8f7c233ea5')
handler = AzureLogHandler(connection_string='InstrumentationKey=a5ab3fd1-7295-40ce-9752-dda04163d715')
handler.setFormatter(logging.Formatter('%(traceId)s %(spanId)s %(message)s'))
logger.addHandler(handler)
# Logging custom Events
logger.addHandler(AzureEventHandler(connection_string='InstrumentationKey=7e65a2c3-807f-4cc1-a93c-2911ce392a47;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/;ApplicationId=586b6e93-e5d3-4ec7-82e7-1a8f7c233ea5'))
logger.addHandler(AzureEventHandler(connection_string='InstrumentationKey=a5ab3fd1-7295-40ce-9752-dda04163d715'))
# Set the logging level
logger.setLevel(logging.INFO)

# Metrics
exporter = metrics_exporter.new_metrics_exporter(
enable_standard_metrics=True,
connection_string='InstrumentationKey=7e65a2c3-807f-4cc1-a93c-2911ce392a47;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/;ApplicationId=586b6e93-e5d3-4ec7-82e7-1a8f7c233ea5')
connection_string='InstrumentationKey=a5ab3fd1-7295-40ce-9752-dda04163d715')
view_manager.register_exporter(exporter)

# Tracing
tracer = Tracer(
exporter=AzureExporter(
connection_string='InstrumentationKey=7e65a2c3-807f-4cc1-a93c-2911ce392a47;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/;ApplicationId=586b6e93-e5d3-4ec7-82e7-1a8f7c233ea5'),
connection_string='InstrumentationKey=a5ab3fd1-7295-40ce-9752-dda04163d715'),
sampler=ProbabilitySampler(1.0),
)
app = Flask(__name__)

# Requests
middleware = FlaskMiddleware(
app,
exporter=AzureExporter(connection_string="InstrumentationKey=7e65a2c3-807f-4cc1-a93c-2911ce392a47;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/;ApplicationId=586b6e93-e5d3-4ec7-82e7-1a8f7c233ea5"),
exporter=AzureExporter(connection_string="InstrumentationKey=a5ab3fd1-7295-40ce-9752-dda04163d715"),
sampler=ProbabilitySampler(rate=1.0)
)

Expand Down

0 comments on commit 224df52

Please sign in to comment.