
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Next generation observability.
✅ logger ✅ loguru ✅ sqlalchemy ✅ supabase ✅ modal ✅ streamlit
Supported libraries from OTel:
✅ aio-pika ✅ aiohttp-client ✅ aiohttp-server ✅ aiopg ✅ asgi ✅ asyncio ✅ asyncpg ✅ aws-lambda ✅ boto ✅ boto3sqs ✅ botocore ✅ cassandra ✅ celery ✅ confluent-kafka ✅ dbapi ✅ django ✅ elasticsearch ✅ falcon ✅ fastapi ✅ flask ✅ grpc ✅ httpx ✅ jinja2 ✅ kafka-python ✅ logging ✅ mysql ✅ mysqlclient ✅ pika ✅ psycopg ✅ psycopg2 ✅ pymemcache ✅ pymongo ✅ pymysql ✅ pyramid ✅ redis ✅ remoulade ✅ requests ✅ sklearn ✅ sqlalchemy ✅ sqlite3 ✅ starlette ✅ system-metrics ✅ threading ✅ tornado ✅ tortoiseorm ✅ urllib ✅ urllib3 ✅ wsgi
Supported libraries from OpenLLMetry:
✅ OpenAI / Azure OpenAI ✅ Anthropic ✅ Cohere ✅ Ollama ✅ Mistral AI ✅ HuggingFace ✅ Bedrock (AWS) ✅ Replicate ✅ Vertex AI (GCP) ✅ Google Generative AI (Gemini) ✅ IBM Watsonx AI ✅ Together AI ✅ Aleph Alpha ✅ Chroma ✅ Pinecone ✅ Qdrant ✅ Weaviate ✅ Milvus ✅ Marqo ✅ LangChain ✅ LlamaIndex ✅ Haystack ✅ LiteLLM
Instrumenting your Python code with Iudex just takes a few steps.
pip install iudex
IUDEX_API_KEY
. You can manually add this to instrument
as well if you use something like a secrets manager.Search
to view your logs.Add this code to the VERY TOP of your entrypoint file, before all imports.
from iudex import instrument
instrument(
service_name="YOUR_SERVICE_NAME", # highly encouraged
env="prod", # dev, local, etc
iudex_api_key="WRITE_ONLY_IUDEX_KEY", # only ever commit your WRITE ONLY key
)
# ^ Must run above all imports
Iudex auto-instrumentation must run before imports in order to patch libraries with specialized, no-overhead instrumentation code.
You should be all set! Iudex will now record logs and trace the entire life cycle for each request.
Go to https://app.iudex.ai/ to start viewing your logs and traces!
You can add custom attributes to your logs by passing a dictionary to the extra
parameter of the logging functions.
logger.info("Hello Iudex!", extra={"my_custom_attribute": "my_custom_value"})
These attributes will be searchable and displayed on your logs in the Iudex dashboard.
You can add custom attributes to the current trace span (if one exists) as follows:
from iudex import set_attribute
# ... inside some function/span
set_attribute(key="my_custom_attribute", value="my_custom_value")
# ... rest of function
These attributes will be searchable and displayed on your trace spans in the Iudex dashboard.
Some frameworks are auto-instrumented through different entrypoints. Find your framework below and follow the instructions to get set up. (If it's not listed, the above section will work just fine!)
Add the following code to your manage.py
file in the main
function entrypoint.
from iudex import instrument
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
instrument()
# ...
Because Modal only loads libraries after running a particular serverless function, you need follow their suggestions for using packages.
For example:
@app.function(image=image, secrets=[modal.Secret.from_name("iudex-api-key")])
def square(x):
import logging
from iudex import instrument
instrument(service_name="test-modal-instrumentation", env="development")
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.info("This log shows up on Iudex!")
return x**2
Streamlit works by running a static Python script which means all you need to do is encapsulate the scripts contents.
iudex
and call instrument()
to the top of your Streamlit app file.start_trace
and end_trace
to the top and bottom of the file, respectively.from iudex import instrument, start_trace, end_trace, trace
instrument(
service_name="YOUR_SERVICE_NAME", # highly encouraged
env="prod", # dev, local, etc
iudex_api_key="WRITE_ONLY_IUDEX_KEY", # only ever commit your WRITE ONLY key
)
# ^ Must run above all imports
import streamlit as st
# call start_trace before your Streamlit app logic
token = start_trace(name="streamlit-app")
# your Streamlit app logic...
def generate_text(topic: str, mood: str = "", style: str = ""):
pass
end_trace(token)
# bottom of the file
trace
decorator to functions that you want to track. This will show the function and its arguments in the stacktrace.@trace
def generate_text(topic: str, mood: str = "", style: str = ""):
...
If your entire Streamlit app runs a single function, then the setup is a bit easier.
iudex
and call instrument()
to the top of your Streamlit app file.trace
decorator to the main function.from iudex import instrument, trace
instrument(
service_name="YOUR_SERVICE_NAME", # highly encouraged
env="prod", # dev, local, etc
iudex_api_key="WRITE_ONLY_IUDEX_KEY", # only ever commit your WRITE ONLY key
)
# ^ Must run above all imports
import streamlit as st
@trace
def main():
# your Streamlit app logic...
main()
trace
decorator to various functions.Iudex automatically traces framework and library functions. For instance, if you use a framework like FastAPI or Django, Iudex will record subsequent library calls, durations, and metadata throughout the lifecycle of each request.
That said, you can also get more granular and trace your own functions. A good heuristic for "when should I trace my own function" is whenever it might be helpful to see the function's stack trace.
Note: You must call iudex.instrument()
earlier in your code (per above) before the traced function is invoked.
from iudex import instrument, trace
instrument(
service_name="YOUR_SERVICE_NAME", # highly encouraged
env="prod", # dev, local, etc
iudex_api_key="WRITE_ONLY_IUDEX_KEY", # only ever commit your WRITE ONLY key
)
# ^ Must run above all imports
@trace
def my_function(arg1, arg2):
pass
You can easily configure Slack alerts on a per-log basis.
First visit https://app.iudex.ai/logs and click on the Add to Slack
button in the top right.
Once installed to your workspace, tag your logs with the iudex.slack_channel_id
attribute.
logger.info("Hello from Slack!", extra={"iudex.slack_channel_id": "YOUR_SLACK_CHANNEL_ID"})
Your channel ID can be found by clicking the name of the channel in the top left, then at the bottom of the dialog that pops up.
As long as the channel is public or you've invited the Iudex app, logs will be sent as messages to their tagged channel any time they are logged.
FAQs
Unknown package
We found that iudex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.