8000 chore/update metrics by poshinchen · Pull Request #248 · strands-agents/sdk-python · GitHub
[go: up one dir, main page]

Skip to content

chore/update metrics #248

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

poshinchen
Copy link
Contributor
@poshinchen poshinchen commented Jun 18, 2025

Description

Start emitting metrics in Strands to the collector if configured.

Documentation PR

Will add them once the exporter work is finished

Type of Change

Other (please describe):

Emit strands metrics

Testing

  • I ran hatch run prepare
  • Unit tests
  • Manually setup meter and view metrics in console:
# Set up the resource
resource = Resource.create({ResourceAttributes.SERVICE_NAME: "strands-otel-test", "environment": "test"})

# Set up metrics with console exporter

from opentelemetry import metrics
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import ConsoleMetricExporter, PeriodicExportingMetricReader

console_metric_reader = PeriodicExportingMetricReader(ConsoleMetricExporter())
metrics_provider = MeterProvider(resource=resource, metric_readers=[console_metric_reader])
metrics.set_meter_provider(metrics_provider)

agent = Agent(tools=[calculator])
result = agent("what is 16*16?")


## Checklist
- [x] I have read the CONTRIBUTING document
- [x] I have added any necessary tests that prove my fix is effective or my feature works
- [ ] I have updated the documentation accordingly
- [ ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
- [x] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published

----

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@poshinchen poshinchen marked this pull request as ready for review June 18, 2025 21:33
@poshinchen poshinchen requested a review from a team June 18, 2025 21:38
@poshinchen poshinchen force-pushed the chore/update-metrics branch from 2adf521 to f361135 Compare June 19, 2025 13:17
@poshinchen poshinchen changed the title [DO NOT MERGE] Chore/update metrics chore/update metrics Jun 19, 2025
@poshinchen poshinchen force-pushed the chore/update-metrics branch from f361135 to c478996 Compare June 19, 2025 14:27
@poshinchen poshinchen force-pushed the chore/update-metrics branch from c478996 to 1c98dfd Compare June 19, 2025 18:54
@poshinchen poshinchen force-pushed the chore/update-metrics branch from 1c98dfd to 1bbf7f4 Compare June 19, 2025 19:14
@poshinchen poshinchen requested review from zastrowm, Unshure and a team June 19, 2025 19:15
zastrowm
zastrowm previously approved these changes Jun 20, 2025
@poshinchen poshinchen merged commit e693738 into strands-agents:main Jun 20, 2025
18 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0