{"id":26562872,"url":"https://github.com/aelfproject/aelf.opentelemetry","last_synced_at":"2026-02-11T15:31:11.043Z","repository":{"id":248562695,"uuid":"829037770","full_name":"AElfProject/aelf.opentelemetry","owner":"AElfProject","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-26T01:34:31.000Z","size":30,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-20T00:56:14.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AElfProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-15T16:18:50.000Z","updated_at":"2024-10-25T13:42:28.000Z","dependencies_parsed_at":"2024-10-25T17:52:29.752Z","dependency_job_id":"b39c8624-ed40-47be-8c9a-8db137f7a997","html_url":"https://github.com/AElfProject/aelf.opentelemetry","commit_stats":null,"previous_names":["aelfproject/aelf.opentelemetry"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/AElfProject/aelf.opentelemetry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf.opentelemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf.opentelemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf.opentelemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf.opentelemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AElfProject","download_url":"https://codeload.github.com/AElfProject/aelf.opentelemetry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf.opentelemetry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29336868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T14:34:07.188Z","status":"ssl_error","status_checked_at":"2026-02-11T14:34:06.809Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T15:29:04.285Z","updated_at":"2026-02-11T15:31:11.025Z","avatar_url":"https://github.com/AElfProject.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AElf OpenTelemetry\n\nAn OpenTelemetry module for use in ABP and Orleans framework.\n\n- [About The Project](#about-the-project)\n- [Getting Started](#getting-started)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Setup](#setup)\n    - [Orleans](#orleans)\n- [Examples](#examples)\n  - [AggregateExecutionTime](#aggregateexecutiontime)\n  - [Instrumentation](#instrumentation)\n- [Contributing](#contributing)\n- [License](#license)\n\n## About The Project\n\nThis project is a module for ABP and Orleans framework to use OpenTelemetry. It provides a simple and fast way to integrate OpenTelemetry in ABP and Orleans framework.\n\nThe module will provide instrumentation for both ASP and Orleans out of the box:\n1. [Orleans Observability](https://learn.microsoft.com/en-us/dotnet/orleans/host/monitoring/?pivots=orleans-7-0)\n2. [AspNetCore Observability](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/README.md)\n3. [HttpClient Observability](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.Http/README.md)\n\n## Getting Started\n\n### Installation\n\nRun the following command in your project to install this module:\n\n```sh\ndotnet add package AElf.OpenTelemetry\n```\n\n### Configuration\n\nTo configure your opentelemetry service name, version and collector's endpoint, you need to add the following to your appsettings.json file:\n\n```json\n{\n  \"OpenTelemetry\": {\n    \"ServiceName\": \"YourServiceName\",\n    \"ServiceVersion\": \"YourServiceVersion\",\n    \"CollectorEndpoint\": \"http://localhost:4315\"\n  }\n}\n```\n\n### Setup\n\nAdd the following dependency to your project's Module class:\n\n```cs\nusing AElf.OpenTelemetry;\n\n[DependsOn(\n    typeof(OpenTelemetryModule)\n)]\npublic class MyTemplateModule : AbpModule\n```\n\nThis will automatically register the OpenTelemetry module and setup your project for instrumentation.\n\n#### Orleans\n\nFor Orleans, you need to add the following to your SiloBuilder:\n\n```csharp\nhostBuilder.UseOrleans((context, siloBuilder) =\u003e\n{\n    siloBuilder.AddActivityPropagation();\n});\n```\n\nDo the same for the Clientbuilder:\n\n```csharp\nhostBuilder.UseOrleansClient((context, clientBuilder) =\u003e\n{\n    clientBuilder.AddActivityPropagation();\n});\n```\n\nThis will automatically propagate the respective activities of the Orleans grain calls.\n\n## Examples\n\nHere are some examples of how to use this module.\n\n### AggregateExecutionTime\n\nAggregateExecutionTime is an attribute that can be used to measure the execution time of a class's method. It can be used in both ABP and Orleans framework, either on the class or method level.\n\nClass level:\n```cs\nusing AElf.OpenTelemetry.ExecutionTime;\n\n[AggregateExecutionTime]\npublic class MessageValidatorGrain : Grain\n```\n\nMethod level:\n```cs\n[AggregateExecutionTime]\npublic Task\u003cbool\u003e IsOffensive(string message)\n```\n\nThe attribute can also be used in ABP's services or controllers.\n```csharp\n[AggregateExecutionTime]\npublic class AuthorAppService : ApplicationService\n```\nThis will automatically measure the execution time of the method of the class and send the data to the OpenTelemetry collector.\n\n**Do note that for Controllers and Application Services in ABP, please make sure that the method you would like metrics for is a virtual method for the attribute to work.**\n\n### Instrumentation\n\nFor custom instrumentation, you can use the `IInstrumentationProvider` interface to create custom spans and metrics. Get the instrumentation provider from the DI container and use it to create spans and metrics.\n\n```csharp\npublic class MessageValidatorGrain : Grain, IMessageValidator\n{\n    private readonly ILogger _logger;\n    private readonly ActivitySource _activitySource;\n    private static readonly string[] OffensiveWords = new string[] {\"offensive\", \"bad\", \"rude\"};\n\n    public MessageValidatorGrain(ILogger\u003cMessageValidatorGrain\u003e logger, IInstrumentationProvider instrumentationProvider)\n    {\n        _logger = logger;\n        _activitySource = instrumentationProvider.ActivitySource;\n    }\n\n    public Task\u003cbool\u003e IsOffensive(string message)\n    {\n        // This will start a custom trace for the IsOffensive method\n        using var myActivity = _activitySource.StartActivity($\"{nameof(MessageValidatorGrain)}.IsOffensive\");\n        \n        _logger.LogInformation(\"\"\"\n                               IsOffensive message received: message = \"{Message}\"\n                               \"\"\",\n            message);\n        \n        return Task.FromResult(OffensiveWords.Any(message.Contains));\n    }\n}\n```\n\n## Contributing\n\nIf you encounter a bug or have a feature request, please use the [Issue Tracker](https://github.com/AElfProject/aelf.opentelemetry/issues/new). The project is also open to contributions, so feel free to fork the project and open pull requests.\n\n## License\n\nDistributed under the MIT License. See [License](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf.opentelemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faelfproject%2Faelf.opentelemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf.opentelemetry/lists"}