{"id":18696193,"url":"https://github.com/apitoolkit/apitoolkit-dotnet","last_synced_at":"2025-04-09T05:46:07.920Z","repository":{"id":162653653,"uuid":"637154393","full_name":"apitoolkit/apitoolkit-dotnet","owner":"apitoolkit","description":"APIToolkit's .Net client SDK.","archived":false,"fork":false,"pushed_at":"2024-04-11T20:11:34.000Z","size":82,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-12T00:05:27.649Z","etag":null,"topics":["apitoolkit","apitoolkit-sdk","dotnet"],"latest_commit_sha":null,"homepage":"","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/apitoolkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-06T17:14:13.000Z","updated_at":"2024-04-14T23:36:17.237Z","dependencies_parsed_at":"2024-04-14T23:36:12.330Z","dependency_job_id":null,"html_url":"https://github.com/apitoolkit/apitoolkit-dotnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apitoolkit%2Fapitoolkit-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apitoolkit","download_url":"https://codeload.github.com/apitoolkit/apitoolkit-dotnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987108,"owners_count":21028891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["apitoolkit","apitoolkit-sdk","dotnet"],"created_at":"2024-11-07T11:17:28.852Z","updated_at":"2025-04-09T05:46:07.889Z","avatar_url":"https://github.com/apitoolkit.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![APItoolkit's Logo](https://github.com/apitoolkit/.github/blob/main/images/logo-white.svg?raw=true#gh-dark-mode-only)\n![APItoolkit's Logo](https://github.com/apitoolkit/.github/blob/main/images/logo-black.svg?raw=true#gh-light-mode-only)\n\n## .NET Core SDK\n\n[![APItoolkit SDK](https://img.shields.io/badge/APItoolkit-SDK-0068ff?logo=dotnet)](https://github.com/topics/apitoolkit-sdk) [![Join Discord Server](https://img.shields.io/badge/Chat-Discord-7289da)](https://apitoolkit.io/discord?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme) [![APItoolkit Docs](https://img.shields.io/badge/Read-Docs-0068ff)](https://apitoolkit.io/docs/sdks/dotnet/dotnetcore?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme) [![Build Status](https://github.com/apitoolkit/apitoolkit-dotnet/workflows/.NET/badge.svg)](https://github.com/apitoolkit/apitoolkit-dotnet1/actions?query=workflow%3ACI) [![NuGet](https://img.shields.io/nuget/v/ApiToolkit.Net.svg)](https://nuget.org/packages/ApiToolkit.Net) [![Nuget](https://img.shields.io/nuget/dt/ApiToolkit.Net.svg)](https://nuget.org/packages/ApiToolkit.Net)\n\nAPIToolkit .NET SDK is a middleware that can be used to monitor HTTP requests. It is provides additional functionalities on top of the open telemetry instrumentation which creates a custom span for each request capturing details about the request including request, response bodies errors and outgoing requests.\n\n\u003c/div\u003e\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Setup OpenTelemetry](#setup-opentelemetry)\n- [APItoolkit SDK Configuration](#sdk-configuration)\n- [Contributing and Help](#contributing-and-help)\n- [License](#license)\n\n---\n\n## Installation\n\nKindly run the command below to install the package:\n\n```sh\ndotnet add package ApiToolkit.Net\n```\n\n## Setup OpenTelemetry\n\nRun the following command to install the OpenTelemetry auto instrumentation for .NET:\n\n```sh\n# Download the bash script\ncurl -sSfL https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh -O\n\n# Install core files\nsh ./otel-dotnet-auto-install.sh\n\n# Enable execution for the instrumentation script\nchmod +x $HOME/.otel-dotnet-auto/instrument.sh\n\n# Setup the instrumentation for the current shell session\n. $HOME/.otel-dotnet-auto/instrument.sh\n```\n\n#### OpenTelemetry Configuration\n\nAfter installating .NET autoinstrumentation packages, you can configure the OpenTelemetry instrumentation by setting the following environment variables:\n\n```sh\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://otelcol.apitoolkit.io:4317\" # Specifies the endpoint to send the traces to.\nexport OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES=\"APItoolkit.HTTPInstrumentation\" # The apitoolkit instrumentation  activity resource.\nexport OTEL_SERVICE_NAME=\"my-service\" # Specifies the name of the service.\nexport OTEL_RESOURCE_ATTRIBUTES=\"at-project-key={ENTER_YOUR_API_KEY_HERE}\" # Adds your API KEY to the resource.\nexport OTEL_EXPORTER_OTLP_PROTOCOL=\"grpc\" # Specifies the protocol to use for the OpenTelemetry exporter.\n```\n\nAfter setting the environment variables, build and run your application and you should see the logs, traces and metrics in the APIToolkit dashboard.\n\n## SDK Configuration\n\nThe SDK allows you to capture the request and response bodies, errors, outgoing requests and more.\n\neg:\n\n```csharp\nusing ApiToolkit.Net;\n\n// Initialize the APItoolkit client\nvar config = new Config\n{\n    Debug = false,\n    Tags = new List\u003cstring\u003e { \"environment: production\", \"region: us-east-1\" },\n    ServiceVersion: \"v2.0\",\n};\nvar client = await APIToolkit.NewClient(config);\n// END Initialize the APItoolkit client\n// Register the middleware to use the initialized client\napp.Use(async (context, next) =\u003e\n{\n    var apiToolkit = new APIToolkit(next, client);\n    await apiToolkit.InvokeAsync(context);\n});\n\n# app.UseEndpoint(..)\n# other middleware and logic\n# ...\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e - Please make sure the APItoolkit middleware is added before `UseEndpoint` and other middleware are initialized.\n\u003e - The `{ENTER_YOUR_API_KEY_HERE}` demo string should be replaced with the [API key](https://apitoolkit.io/docs/dashboard/settings-pages/api-keys?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme) generated from the APItoolkit dashboard.\n\n\u003cbr /\u003e\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e To learn more configuration options (redacting fields, error reporting, outgoing requests, etc.), please read this [SDK documentation](https://apitoolkit.io/docs/sdks/dotnet/dotnetcore?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme).\n\n## Contributing and Help\n\nTo contribute to the development of this SDK or request help from the community and our team, kindly do any of the following:\n\n- Read our [Contributors Guide](https://github.com/apitoolkit/.github/blob/main/CONTRIBUTING.md).\n- Join our community [Discord Server](https://apitoolkit.io/discord?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme).\n- Create a [new issue](https://github.com/apitoolkit/apitoolkit-dotnet/issues/new/choose) in this repository.\n\n## License\n\nThis repository is published under the [MIT](LICENSE) license.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://apitoolkit.io?utm_campaign=devrel\u0026utm_medium=github\u0026utm_source=sdks_readme\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://github.com/apitoolkit/.github/blob/main/images/icon.png?raw=true\" width=\"40\" /\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapitoolkit%2Fapitoolkit-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapitoolkit%2Fapitoolkit-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapitoolkit%2Fapitoolkit-dotnet/lists"}