Skip to content
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

[Feat]: Add OpenLIT as an option for collecting Telemetry #1640

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/config2.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ models:
# pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's

agentops_api_key: "YOUR_AGENTOPS_API_KEY" # get key from https://app.agentops.ai/settings/projects
otlp_endpoint: "YOUR_OPENTELEMETRY_ENDPOINT" # URL endpoint of your OpenTelemetry collector or endpoint
otlp_headers: "YOUR_OPENTELEMETRY_HEADERS" # Authetication headers for the OpenTelemetry collector or endpoint
2 changes: 2 additions & 0 deletions metagpt/config2.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class Config(CLIParams, YamlModel):
enable_longterm_memory: bool = False
code_review_k_times: int = 2
agentops_api_key: str = ""
otlp_endpoint: str = ""
otlp_headers: str = ""

# Will be removed in the future
metagpt_tti_url: str = ""
Expand Down
6 changes: 6 additions & 0 deletions metagpt/software_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import agentops
import openlit
import typer

from metagpt.const import CONFIG_ROOT
Expand Down Expand Up @@ -41,6 +42,11 @@ def generate_repo(

if config.agentops_api_key != "":
agentops.init(config.agentops_api_key, tags=["software_company"])
elif config.otlp_endpoint != "":
if config.otlp_headers != "":
openlit.init(otlp_endpoint = config.otlp_endpoint, otlp_headers=config.otlp_headers)
else:
openlit.init(otlp_endpoint = config.otlp_endpoint)

config.update_via_cli(project_path, project_name, inc, reqa_file, max_auto_summarize_code)
ctx = Context(config=config)
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ gymnasium==0.29.1
boto3~=1.34.69
spark_ai_python~=0.3.30
agentops
openlit
tree_sitter~=0.23.2
tree_sitter_python~=0.23.2
httpx==0.27.2
httpx==0.27.2
Loading