-
Notifications
You must be signed in to change notification settings - Fork 73
feat: instrument telemetry #355
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
base: main
Are you sure you want to change the base?
Conversation
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
psschwei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Viewed using Jaeger:
Console output:
$ uv run python docs/examples/instruct_validate_repair/101_email.py
=== 15:14:33-INFO ======
Starting Mellea session: backend=ollama, model=granite4:micro, context=SimpleContext, model_options={'@@@max_new_tokens@@@': 200}
0%| | 0/2 [00:00<?, ?it/s]=== 15:14:37-INFO ======
SUCCESS
0%| | 0/2 [00:03<?, ?it/s]
[{'role': 'user', 'content': 'Write an email to invite all interns to the office party.', 'images': None}]
Calling end() on an ended span.
***** email ****
Subject: Invitation for Our Annual Office Party
Dear All Interns,
We hope this message finds you well.
As part of our
commitment to fostering a sense of community within our organization, we would like to cordially invite all interns to
join us for our annual office party. This event is not only an opportunity for fun and networking but also a chance to
celebrate the achievements of the year and look forward to new opportunities in the coming year.
Here are the details:
**Date:** [Insert Date]
**Time:** [Insert Time]
**Venue:** [Insert Venue]
The evening will feature entertainment,
refreshments, and engaging conversations. We encourage you all to dress according to our company's formal attire policy
for this event.
We believe that your contribution is crucial to our success and we are excited about the potential
projects and ideas that lie ahead. This party is a wonderful opportunity to mingle with other interns from different
departments and share some memorable moments together.
Please RSVP by [Insert Date] so we can
*******
{
"name": "start_session",
"context": {
"trace_id": "0xcb77451be2139eeee65422fb74fc2a56",
"span_id": "0x8ed3d33ef3c5baed",
"trace_state": "[]"
},
"kind": "SpanKind.INTERNAL",
"parent_id": null,
"start_time": "2026-01-26T20:14:33.550934Z",
"end_time": "2026-01-26T20:14:33.671424Z",
"status": {
"status_code": "UNSET"
},
"attributes": {
"backend": "ollama",
"model_id": "granite4:micro",
"context_type": "SimpleContext"
},
"events": [],
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.38.0",
"service.name": "my-mellea-app"
},
"schema_url": ""
}
}
{
"name": "session_context",
"context": {
"trace_id": "0x8adc89297851d8b1a677334ba5c2ee2c",
"span_id": "0x38d0ffe787d3904d",
"trace_state": "[]"
},
"kind": "SpanKind.INTERNAL",
"parent_id": null,
"start_time": "2026-01-26T20:14:33.671493Z",
"end_time": "2026-01-26T20:14:33.671512Z",
"status": {
"status_code": "UNSET"
},
"attributes": {
"backend": "OllamaModelBackend",
"context_type": "SimpleContext"
},
"events": [],
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.38.0",
"service.name": "my-mellea-app"
},
"schema_url": ""
}
}
{
"name": "generate_from_context",
"context": {
"trace_id": "0x39a9159baa5e4915d07d31536f09e224",
"span_id": "0x234a5cfb7d16861e",
"trace_state": "[]"
},
"kind": "SpanKind.INTERNAL",
"parent_id": "0x6b624448401e507b",
"start_time": "2026-01-26T20:14:33.673531Z",
"end_time": "2026-01-26T20:14:33.690153Z",
"status": {
"status_code": "UNSET"
},
"attributes": {
"backend": "OllamaModelBackend",
"model_id": "ibm-granite/granite-4.0-micro",
"action_type": "Instruction",
"context_size": "0",
"has_format": "False",
"tool_calls": "False"
},
"events": [],
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.38.0",
"service.name": "my-mellea-app"
},
"schema_url": ""
}
}
{
"name": "aact",
"context": {
"trace_id": "0x39a9159baa5e4915d07d31536f09e224",
"span_id": "0x6b624448401e507b",
"trace_state": "[]"
},
"kind": "SpanKind.INTERNAL",
"parent_id": null,
"start_time": "2026-01-26T20:14:33.671686Z",
"end_time": "2026-01-26T20:14:37.671402Z",
"status": {
"status_code": "UNSET"
},
"attributes": {
"action_type": "Instruction",
"has_requirements": "False",
"has_strategy": "True",
"strategy_type": "RejectionSamplingStrategy",
"has_format": "False",
"tool_calls": "False",
"num_generate_logs": "1",
"sampling_success": "True",
"response": "Subject: Invitation for Our Annual Office Party\n\nDear All Interns,\n\nWe hope this message finds you well.\n\nAs part of our commitment to fostering a sense of community within our organization, we would like to cordially invite all interns to join us for our annual office party. This event is not only an opportunity for fun and networking but also a chance to celebrate the achievements of the year and look forward to new opportunities in the coming year.\n\nHere are the details:\n\n**Date:** [Insert Da...",
"response_length": "1042"
},
"events": [],
"links": [],
"resource": {
"attributes": {
"telemetry.sdk.language": "python",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.38.0",
"service.name": "my-mellea-app"
},
"schema_url": ""
}
}
docs/dev/telemetry.md
Outdated
| ```bash | ||
| export MELLEA_TRACE_APPLICATION=true | ||
| export MELLEA_TRACE_BACKEND=false | ||
| python your_script.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would it make sense to use one of the existing examples for the docs, so that folks could easily copy and paste the code snippets to try them out? (maybe docs/examples/instruct_validate_repair/101_email.py)
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
bf39114 to
e83afa2
Compare

Misc PR
Type of PR
Description
Testing