-
Notifications
You must be signed in to change notification settings - Fork 18
Adding OpenTelemetry OTLP exporter support #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dasiths
wants to merge
19
commits into
microsoft:main
Choose a base branch
from
dasiths:dasithw/add-otlp-exporter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0489c3e
add otlp exporter config
dasiths c22b758
add otlp exporters
dasiths 0f156a8
fixup
dasiths 1dfd7c9
fixup
dasiths d5d15ca
add docker compose for telemetry
dasiths d30b6a4
read service name from env
dasiths bce47c7
add request instrumentor
dasiths 103ba8b
fixup
dasiths bfffbe8
move telemetry to separate file
dasiths 52026cf
fixup
dasiths bfb8d0c
fixup
dasiths ebeb49d
fixup
dasiths 05d8657
Merge remote-tracking branch 'origin/main' into dasithw/add-otlp-expo…
dasiths 6db7cbb
refactor
dasiths fb9fe42
fixup
dasiths 612608d
Merge branch 'main' into dasithw/add-otlp-exporter
stuartleeks f395b9a
Merge branch 'main' into dasithw/add-otlp-exporter
stuartleeks 5f113a2
fixup low-hanging linter warnings
stuartleeks 8750ecc
Merge branch 'main' into dasithw/add-otlp-exporter
stuartleeks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -8,7 +8,7 @@ __pycache__/ | |
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
*/build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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,8 @@ | ||
services: | ||
grafana-all-in-one: # https://grafana.com/blog/2024/03/13/an-opentelemetry-backend-in-a-docker-image-introducing-grafana/otel-lgtm/ | ||
image: grafana/otel-lgtm | ||
container_name: otel-lgtm | ||
ports: | ||
- "3000:3000" # Grafana Web UI | ||
- "4317:4317" # OTLP gRPC receiver | ||
- "4318:4318" # OTLP http receiver |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,33 +1,15 @@ | ||
import logging | ||
import os | ||
|
||
from azure.monitor.opentelemetry import configure_azure_monitor | ||
from aoai_api_simulator.app_builder import app as builder_app | ||
from aoai_api_simulator.app_builder import apply_config | ||
|
||
# from opentelemetry import trace | ||
|
||
from aoai_api_simulator.config_loader import get_config_from_env_vars, set_config | ||
from aoai_api_simulator.app_builder import app as builder_app, apply_config | ||
|
||
log_level = os.getenv("LOG_LEVEL") or "INFO" | ||
|
||
logger = logging.getLogger(__name__) | ||
logging.basicConfig(level=log_level) | ||
logging.getLogger("azure").setLevel(logging.WARNING) | ||
|
||
application_insights_connection_string = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") | ||
if application_insights_connection_string: | ||
logger.info("🚀 Configuring Azure Monitor telemetry") | ||
from aoai_api_simulator.telemetry import setup_auto_instrumentation, setup_telemetry | ||
|
||
# Options: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry#usage | ||
configure_azure_monitor(connection_string=application_insights_connection_string) | ||
else: | ||
logger.info("🚀 Azure Monitor telemetry not configured (set APPLICATIONINSIGHTS_CONNECTION_STRING)") | ||
using_azure_monitor: bool = setup_telemetry() | ||
|
||
# tracer = trace.get_tracer(__name__) | ||
|
||
config = get_config_from_env_vars(logger) | ||
config = get_config_from_env_vars() | ||
set_config(config) | ||
|
||
|
||
apply_config() | ||
|
||
app = builder_app # expose to gunicorn | ||
setup_auto_instrumentation(app, using_azure_monitor) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.