Skip to content

feat: add meter #219

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 18, 2025
Merged

Conversation

poshinchen
Copy link
Contributor

@poshinchen poshinchen commented Jun 13, 2025

Description

Initiated OTEL Meter in Strands in order to send metrics.

Note:
User has to setup global meter_provider for strands to use them directly (will update the documentation).

Documentation PR

Will update the documentation along with the traces.

Type of Change

  • New feature

Testing

  • Added unit tests
  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all
  • Tested manually with and without global OTEL Meter setup:
# Set up the resource
resource = Resource.create({ResourceAttributes.SERVICE_NAME: "strands-otel-test", "environment": "test"})

# Set up metrics with console exporter
console_metric_reader = PeriodicExportingMetricReader(ConsoleMetricExporter())
metrics_provider = MeterProvider(resource=resource, metric_readers=[console_metric_reader])
metrics.set_meter_provider(metrics_provider)
  • Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

Checklist

  • I have read the CONTRIBUTING document
  • I have added 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
  • 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 requested a review from jer96 June 13, 2025 21:17
@poshinchen poshinchen force-pushed the chore/add-meter branch 2 times, most recently from 13f90b7 to e6474dc Compare June 15, 2025 16:25
@poshinchen poshinchen changed the title [WIP DO NOT MERGED] Chore/add meter Chore/add meter Jun 15, 2025
@poshinchen poshinchen requested review from zastrowm and awsarron June 15, 2025 22:52
@poshinchen poshinchen self-assigned this Jun 15, 2025
@poshinchen poshinchen marked this pull request as ready for review June 16, 2025 02:15
@poshinchen poshinchen changed the title Chore/add meter feat: add meter Jun 16, 2025
@poshinchen poshinchen requested a review from jer96 June 18, 2025 17:41
@poshinchen poshinchen requested a review from a team June 18, 2025 21:38
@poshinchen poshinchen merged commit 4d7bb98 into strands-agents:main Jun 18, 2025
29 of 32 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