├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ └── Feature_request.md ├── config.yml ├── renovate.json └── workflows │ ├── code-coverage.yml │ └── codeql-analysis.yml ├── .gitignore ├── LICENSE ├── README.md ├── build ├── ci-build.yml ├── deploy-test-resources.yml ├── nuget-release.yml ├── templates │ ├── deploy-test-resources.bicep │ ├── import-keyvault-secrets.yml │ ├── run-self-contained-integration-tests.yml │ └── run-unit-tests.yml └── variables │ ├── build.yml │ └── test.yml ├── docs ├── README.md ├── babel.config.js ├── docusaurus.build.config.js ├── docusaurus.config.js ├── package-lock.json ├── package.json ├── preview │ ├── 01-index.md │ ├── 02-Guidance │ │ ├── Service-to-service Correlation │ │ │ ├── index.md │ │ │ ├── use-service-to-service-correlation-in-service-bus.md │ │ │ └── use-service-to-service-correlation-in-web-api.md │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ └── use-with-dotnet-and-functions.md │ └── 03-Features │ │ ├── correlation.md │ │ ├── making-telemetry-more-powerful.md │ │ ├── sinks │ │ └── azure-application-insights.md │ │ ├── telemetry-enrichment.md │ │ ├── telemetry-filter.md │ │ └── writing-different-telemetry-types.md ├── sidebars.js ├── src │ ├── css │ │ └── custom.css │ ├── pages │ │ └── index.module.css │ └── prism │ │ ├── dark.js │ │ └── light.js ├── static │ ├── img │ │ ├── arcus.jpg │ │ ├── arcus.png │ │ ├── arcus_for_dark.png │ │ ├── favicon.ico │ │ ├── icon.png │ │ └── logger-arcus-appinsights.png │ └── media │ │ ├── http-correlation-w3c.png │ │ ├── http-correlation.png │ │ ├── multi-dimensional-metrics.png │ │ ├── product-stock-api-service-correlation-example-applicationmap.png │ │ ├── product-stock-api-service-correlation-example-transactionsearch.png │ │ ├── product-stock-api-service-w3c-correlation-example-transactionsearch.png │ │ ├── service-to-service-api-worker-diagram-example.png │ │ ├── service-to-service-api-worker-w3c-diagram-example.png │ │ ├── service-to-service-correlation-application-map.png │ │ ├── service-to-service-correlation-relationship.png │ │ ├── servicebus-worker-service-correlation-example-applicationmap.png │ │ ├── servicebus-worker-service-correlation-example-transactionsearch.png │ │ ├── servicebus-worker-service-w3c-correlation-example-applicationmap.png │ │ ├── servicebus-worker-service-w3c-correlation-example-transactionsearch.png │ │ └── single-dimensional-metric.png ├── versioned_docs │ ├── version-v0.1.0 │ │ ├── 01-index.md │ │ └── 02-Features │ │ │ ├── correlation.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v0.1.1 │ │ ├── 01-index.md │ │ └── 02-Features │ │ │ ├── correlation.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v0.2.0 │ │ ├── 01-index.md │ │ └── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v0.3 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v0.4 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v1.0 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.0 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.1 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.2 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.3 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.4 │ │ ├── 01-index.md │ │ ├── 02-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ │ └── 03-Guidance │ │ │ └── use-with-dotnet-and-functions.md │ ├── version-v2.5.0 │ │ ├── 01-index.md │ │ ├── 02-Guidance │ │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ │ └── use-with-dotnet-and-functions.md │ │ └── 03-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v2.6.0 │ │ ├── 01-index.md │ │ ├── 02-Guidance │ │ │ ├── Service-to-service Correlation │ │ │ │ ├── index.md │ │ │ │ ├── use-service-to-service-correlation-in-service-bus.md │ │ │ │ └── use-service-to-service-correlation-in-web-api.md │ │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ │ └── use-with-dotnet-and-functions.md │ │ └── 03-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v2.7.0 │ │ ├── 01-index.md │ │ ├── 02-Guidance │ │ │ ├── Service-to-service Correlation │ │ │ │ ├── index.md │ │ │ │ ├── use-service-to-service-correlation-in-service-bus.md │ │ │ │ └── use-service-to-service-correlation-in-web-api.md │ │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ │ └── use-with-dotnet-and-functions.md │ │ └── 03-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ ├── version-v2.8.0 │ │ ├── 01-index.md │ │ ├── 02-Guidance │ │ │ ├── Service-to-service Correlation │ │ │ │ ├── index.md │ │ │ │ ├── use-service-to-service-correlation-in-service-bus.md │ │ │ │ └── use-service-to-service-correlation-in-web-api.md │ │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ │ └── use-with-dotnet-and-functions.md │ │ └── 03-Features │ │ │ ├── correlation.md │ │ │ ├── making-telemetry-more-powerful.md │ │ │ ├── sinks │ │ │ └── azure-application-insights.md │ │ │ ├── telemetry-enrichment.md │ │ │ ├── telemetry-filter.md │ │ │ └── writing-different-telemetry-types.md │ └── version-v3.0.0 │ │ ├── 01-index.md │ │ ├── 02-Guidance │ │ ├── Service-to-service Correlation │ │ │ ├── index.md │ │ │ ├── use-service-to-service-correlation-in-service-bus.md │ │ │ └── use-service-to-service-correlation-in-web-api.md │ │ ├── use-with-dotnet-and-aspnetcore.md │ │ └── use-with-dotnet-and-functions.md │ │ └── 03-Features │ │ ├── correlation.md │ │ ├── making-telemetry-more-powerful.md │ │ ├── sinks │ │ └── azure-application-insights.md │ │ ├── telemetry-enrichment.md │ │ ├── telemetry-filter.md │ │ └── writing-different-telemetry-types.md ├── versioned_sidebars │ ├── version-v0.1.0-sidebars.json │ ├── version-v0.1.1-sidebars.json │ ├── version-v0.2.0-sidebars.json │ ├── version-v0.3-sidebars.json │ ├── version-v0.4-sidebars.json │ ├── version-v1.0-sidebars.json │ ├── version-v2.0-sidebars.json │ ├── version-v2.1-sidebars.json │ ├── version-v2.2-sidebars.json │ ├── version-v2.3-sidebars.json │ ├── version-v2.4-sidebars.json │ ├── version-v2.5.0-sidebars.json │ ├── version-v2.6.0-sidebars.json │ ├── version-v2.7.0-sidebars.json │ ├── version-v2.8.0-sidebars.json │ └── version-v3.0.0-sidebars.json └── versions.json ├── netlify.toml └── src ├── .dockerignore ├── Arcus.Observability.Correlation ├── Arcus.Observability.Correlation.csproj ├── CorrelationInfo.cs ├── CorrelationInfoAccessorProxy.cs ├── DefaultCorrelationInfoAccessor.cs ├── DefaultCorrelationInfoAccessorT.cs ├── ICorrelationInfoAccessor.cs ├── ICorrelationInfoAccessorT.cs └── IServiceCollectionExtensions.cs ├── Arcus.Observability.Telemetry.AspNetCore ├── Arcus.Observability.Telemetry.AspNetCore.csproj └── Extensions │ ├── ILoggerHttpDependencyExtensions.cs │ └── ILoggerRequestExtensions.cs ├── Arcus.Observability.Telemetry.Core ├── Arcus.Observability.Telemetry.Core.csproj ├── AssemblyAppVersion.cs ├── ContextProperties.cs ├── DefaultAppName.cs ├── DurationMeasurement.cs ├── Extensions │ ├── ILoggerAzureKeyVaultDependencyExtensions.cs │ ├── ILoggerAzureSearchDependencyExtensions.cs │ ├── ILoggerBlobStorageDependencyExtensions.cs │ ├── ILoggerCosmosSqlDependencyExtensions.cs │ ├── ILoggerCustomDependencyExtensions.cs │ ├── ILoggerEventExtensions.cs │ ├── ILoggerEventHubsDependencyExtensions.cs │ ├── ILoggerEventHubsRequestExtensions.cs │ ├── ILoggerGeneralExtensions.cs │ ├── ILoggerGeneralRequestExtensions.cs │ ├── ILoggerHttpDependencyExtensions.cs │ ├── ILoggerIotHubDependencyExtensions.cs │ ├── ILoggerMetricExtensions.cs │ ├── ILoggerRequestExtensions.cs │ ├── ILoggerServiceBusDependencyExtensions.cs │ ├── ILoggerServiceBusRequestExtensions.cs │ ├── ILoggerSqlDependencyExtensions.cs │ ├── ILoggerTableStorageDependencyExtensions.cs │ ├── IReadOnlyDictionaryExtensions.cs │ └── ServiceBusEntityType.cs ├── FormatSpecifiers.cs ├── IAppName.cs ├── IAppVersion.cs ├── Iot │ ├── IotHubConnectionStringParser.cs │ └── IotHubConnectionStringParserResult.cs ├── Logging │ ├── DependencyLogEntry.cs │ ├── EventLogEntry.cs │ ├── MetricLogEntry.cs │ ├── RequestLogEntry.cs │ └── RequestSourceSystem.cs ├── MessageFormats.cs ├── MessagePrefixes.cs ├── Sql │ ├── SqlConnectionStringParser.cs │ └── SqlConnectionStringParserResult.cs └── TelemetryType.cs ├── Arcus.Observability.Telemetry.Serilog.Enrichers ├── ApplicationEnricher.cs ├── Arcus.Observability.Telemetry.Serilog.Enrichers.csproj ├── Configuration │ └── CorrelationInfoEnricherOptions.cs ├── CorrelationInfoEnricher.cs ├── Extensions │ ├── LogEventExtensions.cs │ ├── LogEventPropertyValueExtensions.cs │ └── LoggerEnrichmentConfigurationExtensions.cs ├── KubernetesEnricher.cs └── VersionEnricher.cs ├── Arcus.Observability.Telemetry.Serilog.Filters ├── Arcus.Observability.Telemetry.Serilog.Filters.csproj └── TelemetryTypeFilter.cs ├── Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights ├── Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.csproj ├── Configuration │ ├── ApplicationInsightsSinkCorrelationOptions.cs │ ├── ApplicationInsightsSinkExceptionOptions.cs │ ├── ApplicationInsightsSinkOptions.cs │ ├── ApplicationInsightsSinkRequestOptions.cs │ ├── ApplicationNameTelemetryInitializer.cs │ └── ApplicationVersionTelemetryInitializer.cs ├── Converters │ ├── ApplicationInsightsTelemetryConverter.cs │ ├── CloudContextConverter.cs │ ├── CustomTelemetryConverter.cs │ ├── DependencyTelemetryConverter.cs │ ├── EventTelemetryConverter.cs │ ├── ExceptionTelemetryConverter.cs │ ├── MetricTelemetryConverter.cs │ ├── OperationContextConverter.cs │ ├── RequestTelemetryConverter.cs │ └── TraceTelemetryConverter.cs ├── DependencyType.cs └── Extensions │ ├── IDictionaryExtensions.cs │ ├── ILoggingBuilderExtensions.cs │ ├── IServiceCollectionExtensions.cs │ ├── LogEventPropertyExtensions.cs │ └── LoggerSinkConfigurationExtensions.cs ├── Arcus.Observability.Tests.Core ├── Arcus.Observability.Tests.Core.csproj ├── InMemoryLogSink.cs └── TemporaryEnvironmentVariable.cs ├── Arcus.Observability.Tests.Integration ├── Arcus.Observability.Tests.Integration.csproj ├── AssertX.cs ├── Configuration │ └── ServicePrincipal.cs ├── Fixture │ └── TestException.cs ├── IntegrationTest.cs ├── Serilog │ ├── KubernetesEnricherTests.cs │ ├── Sinks │ │ └── ApplicationInsights │ │ │ ├── AppInsightsClient.cs │ │ │ ├── ApplicationInsightsSinkExtensionTests.cs │ │ │ ├── ApplicationInsightsSinkTests.cs │ │ │ ├── AzureKeyVaultDependencyTests.cs │ │ │ ├── AzureSearchDependencyTests.cs │ │ │ ├── BlobStorageDependencyTests.cs │ │ │ ├── CosmosSqlDependencyTests.cs │ │ │ ├── CustomDependencyTests.cs │ │ │ ├── CustomRequestTests.cs │ │ │ ├── EventHubsDependencyTests.cs │ │ │ ├── EventHubsRequestTests.cs │ │ │ ├── EventTests.cs │ │ │ ├── ExceptionTests.cs │ │ │ ├── Fixture │ │ │ ├── ITelemetryQueryClient.cs │ │ │ ├── InMemoryApplicationInsightsTelemetryConverter.cs │ │ │ └── InMemoryTelemetryQueryClient.cs │ │ │ ├── HttpDependencyTests.cs │ │ │ ├── IoTHubTests.cs │ │ │ ├── MetricTests.cs │ │ │ ├── RequestTests.cs │ │ │ ├── ServiceBusDependencyTests.cs │ │ │ ├── ServiceBusRequestTests.cs │ │ │ ├── SqlDependencyTests.cs │ │ │ ├── TableStorageDependencyTests.cs │ │ │ └── TraceTests.cs │ ├── TelemetryTypeFilterTests.cs │ └── XunitLogEventSink.cs └── appsettings.json ├── Arcus.Observability.Tests.Unit ├── Arcus.Observability.Tests.Unit.csproj ├── Blanks.cs ├── Correlation │ ├── CorrelationInfoTests.cs │ ├── IServiceCollectionExtensionsTests.cs │ ├── TestCorrelationInfo.cs │ └── TestCorrelationInfoAccessor.cs ├── Extensions │ └── TestLoggerExtensions.cs ├── Fixture │ ├── Order.cs │ └── OrderGenerator.cs ├── Iot │ └── IotHubConnectionStringParserTests.cs ├── Serilog │ ├── ApplicationInsightsSinkCorrelationOptionsTests.cs │ ├── ApplicationInsightsTelemetryConverterTests.cs │ ├── AssemblyAppVersionTests.cs │ ├── CloudContextConverterTests.cs │ ├── CustomTelemetryConverterTests.cs │ ├── Enrichers │ │ ├── ApplicationEnricherTests.cs │ │ ├── Configuration │ │ │ └── CorrelationInfoEnricherOptionsTests.cs │ │ ├── CorrelationInfoEnricherTests.cs │ │ ├── KubernetesEnricherTests.cs │ │ ├── TestCorrelationInfoEnricher.cs │ │ └── VersionEnricherTests.cs │ ├── Extensions │ │ └── LogEventPropertyValueExtensionsTests.cs │ ├── ILoggingBuilderExtensionsTests.cs │ ├── IServiceCollectionExtensionsTests.cs │ ├── LogEventPropertyValueExtensionsTests.cs │ ├── OperationContextConverterTests.cs │ └── Sinks │ │ └── ApplicationInsights │ │ ├── ApplicationInsightsSinkExceptionOptionsTests.cs │ │ ├── ApplicationInsightsSinkRequestOptionsTests.cs │ │ └── LoggerConfigurationExtensionsTests.cs ├── Sql │ └── SqlConnectionStringParserTests.cs ├── Telemetry │ ├── DummyAppVersion.cs │ ├── IServiceCollectionExtensionsTests.cs │ ├── Logging │ │ ├── AzureBlobStorageDependencyLoggingTests.cs │ │ ├── AzureKeyVaultDependencyLoggingTests.cs │ │ ├── AzureSearchDependencyLoggingTests.cs │ │ ├── AzureServiceBusDependencyLoggingTests.cs │ │ ├── AzureServiceBusRequestLoggingTests.cs │ │ ├── AzureTableStorageDependencyTests.cs │ │ ├── CosmosSqlDependencyLoggingTests.cs │ │ ├── CustomDependencyLoggingTests.cs │ │ ├── CustomRequestLoggingTests.cs │ │ ├── EventHubsDependencyLoggingTests.cs │ │ ├── EventHubsRequestLoggingTests.cs │ │ ├── EventLoggingTests.cs │ │ ├── GeneralLoggingTests.cs │ │ ├── HttpDependencyLoggingTests.cs │ │ ├── HttpRequestLoggingTests.cs │ │ ├── IoTHubDependencyLoggingTests.cs │ │ ├── MetricLoggingTests.cs │ │ ├── SecurityEventLoggingTests.cs │ │ └── SqlDependencyLoggingTests.cs │ ├── StubAppVersion.cs │ ├── TelemetryTypeFilterTests.cs │ └── TimeSpanGenerator.cs └── TestLogger.cs └── Arcus.Observability.sln /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo. 2 | * @stijnmoreels @fgheysels 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 13 | **Expected behavior** 14 | A clear and concise description of what you expected to happen. 15 | 16 | **Additional context** 17 | Add any other context about the problem here. 18 | - Version 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Ask a question 💬 4 | url: https://github.com/arcus-azure/arcus.observability/discussions/new 5 | about: Ask a question or request support for using Arcus Observability. 6 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "assigneesFromCodeOwners": true, 3 | "separateMajorMinor": true, 4 | "separateMultipleMajor": false, 5 | "masterIssue": false, 6 | "branchPrefix":"renovate-", 7 | "labels":["dependencies"], 8 | "ignoreDeps":[], 9 | "prHourlyLimit": 0, 10 | "prConcurrentLimit": 0, 11 | "extends": [ 12 | "config:base", 13 | "default:disablePrControls" 14 | ], 15 | "nuget": { 16 | "enabled": true 17 | }, 18 | "ignorePaths": [ 19 | "**/docs/**" 20 | ], 21 | "vulnerabilityAlerts": { 22 | "enabled": true 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /.github/workflows/code-coverage.yml: -------------------------------------------------------------------------------- 1 | name: "Code Coverage" 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [ main ] 9 | 10 | jobs: 11 | analyze: 12 | name: Analyze 13 | runs-on: ubuntu-latest 14 | permissions: 15 | actions: read 16 | contents: read 17 | 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | language: [ 'csharp' ] 22 | 23 | steps: 24 | - name: Checkout repository 25 | uses: actions/checkout@v2 26 | - uses: actions/setup-dotnet@v3 27 | with: 28 | dotnet-version: '8.0.x' 29 | dotnet-quality: 'preview' 30 | - name: Coverlet coverage test 31 | uses: b3b00/coverlet-action@1.2.4 32 | with: 33 | testProject: 'src/Arcus.Observability.Tests.Unit/Arcus.Observability.Tests.Unit.csproj' 34 | excludes: '[Arcus.Observability.Tests.*]**' 35 | threshold: 80 36 | output: 'coverage.xml' 37 | outputFormat: 'opencover' 38 | 39 | - name: Codecov 40 | uses: codecov/codecov-action@v3.1.1 41 | if: always() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Arcus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arcus - Observability 2 | [![Build Status](https://dev.azure.com/codit/Arcus/_apis/build/status/Commit%20builds/CI%20-%20Arcus.Observability?branchName=main)](https://dev.azure.com/codit/Arcus/_build/latest?definitionId=800&branchName=main) 3 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?includePreReleases=true)](https://www.nuget.org/packages/Arcus.Observability.Correlation/) 4 | [![codecov](https://codecov.io/gh/arcus-azure/arcus.observability/branch/main/graph/badge.svg?token=59ITMASWGX)](https://codecov.io/gh/arcus-azure/arcus.observability) 5 | 6 | Observability with Microsoft Azure in a breeze. 7 | 8 | ![Arcus](https://raw.githubusercontent.com/arcus-azure/arcus/master/media/arcus.png) 9 | 10 | # Documentation 11 | All documentation can be found on [here](https://observability.arcus-azure.net/). 12 | 13 | # Customers 14 | Are you an Arcus user? Let us know and [get listed](https://bit.ly/become-a-listed-arcus-user)! 15 | 16 | # License Information 17 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 18 | 19 | Read the full license [here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE). 20 | -------------------------------------------------------------------------------- /build/deploy-test-resources.yml: -------------------------------------------------------------------------------- 1 | name: Arcus Observability - Deploy test resources 2 | 3 | trigger: none 4 | pr: none 5 | 6 | parameters: 7 | - name: azureServiceConnection 8 | displayName: 'Azure service connection' 9 | type: string 10 | default: 'Azure Codit-Arcus Service Principal' 11 | - name: resourceGroupName 12 | displayName: 'Resource group name' 13 | default: arcus-observability-dev-we-rg 14 | 15 | variables: 16 | - template: ./variables/build.yml 17 | - template: ./variables/test.yml 18 | 19 | stages: 20 | - stage: Deploy 21 | jobs: 22 | - job: DeployBicep 23 | displayName: 'Deploy test resources' 24 | pool: 25 | vmImage: '$(Vm.Image)' 26 | steps: 27 | - task: AzureCLI@2 28 | env: 29 | SYSTEM_ACCESSTOKEN: $(System.AccessToken) 30 | inputs: 31 | azureSubscription: '${{ parameters.azureServiceConnection }}' 32 | addSpnToEnvironment: true 33 | scriptType: 'pscore' 34 | scriptLocation: 'inlineScript' 35 | inlineScript: | 36 | $objectId = (az ad sp show --id $env:servicePrincipalId | ConvertFrom-Json).id 37 | az deployment sub create ` 38 | --location westeurope ` 39 | --template-file ./build/templates/deploy-test-resources.bicep ` 40 | --parameters location=westeurope ` 41 | --parameters resourceGroupName=${{ parameters.resourceGroupName }} ` 42 | --parameters instrumentationKey_secretName=${{ variables['Arcus.Observability.ApplicationInsights.InstrumentationKey.SecretName'] }} ` 43 | --parameters workspaceId_secretName=${{ variables['Arcus.Observability.LogAnalytics.WorkspaceId.SecretName'] }} ` 44 | --parameters keyVaultName=${{ variables['Arcus.Observability.KeyVault.Name'] }} ` 45 | --parameters servicePrincipal_objectId=$objectId -------------------------------------------------------------------------------- /build/templates/import-keyvault-secrets.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | azureServiceConnection: '' 3 | 4 | steps: 5 | - task: AzureCLI@2 6 | displayName: 'Import secrets from Azure Key Vault' 7 | inputs: 8 | azureSubscription: '${{ parameters.azureServiceConnection }}' 9 | addSpnToEnvironment: true 10 | scriptType: 'pscore' 11 | scriptLocation: 'inlineScript' 12 | inlineScript: | 13 | Set-PSRepository -Name PSGallery -InstallationPolicy Trusted 14 | Install-Module -Name Arcus.Scripting.DevOps -AllowClobber 15 | 16 | Set-AzDevOpsVariable -Name 'Arcus.Observability.TenantId' -Value $env:tenantId 17 | Set-AzDevOpsVariable -Name 'Arcus.Observability.ServicePrincipal.ClientId' -Value $env:servicePrincipalId 18 | Set-AzDevOpsVariable -Name 'Arcus.Observability.ServicePrincipal.ClientSecret' -Value $env:servicePrincipalKey 19 | 20 | $keyVaultName = $env:ARCUS_OBSERVABILITY_KEYVAULT_NAME 21 | Write-Host "Importing secrets from Key Vault: $keyVaultName" 22 | 23 | $instrumentationKey_secretName = $env:ARCUS_OBSERVABILITY_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY_SECRETNAME 24 | Write-Host "Importing secret: $instrumentationKey_secretName" 25 | $instrumentationKeySecret = az keyvault secret show --name "$instrumentationKey_secretName" --vault-name "$keyVaultName" | ConvertFrom-Json 26 | Set-AzDevOpsVariable -AsSecret -Name 'Arcus.Observability.ApplicationInsights.InstrumentationKey' -Value $instrumentationKeySecret.value 27 | 28 | $resourceId_secretName = $env:ARCUS_OBSERVABILITY_LOGANALYTICS_WORKSPACEID_SECRETNAME 29 | Write-Host "Importing secret: $resourceId_secretName" 30 | $resourceIdSecret = az keyvault secret show --name "$resourceId_secretName" --vault-name "$keyVaultName" | ConvertFrom-Json 31 | Set-AzDevOpsVariable -AsSecret -Name 'Arcus.Observability.ApplicationInsights.LogAnalytics.WorkspaceId' -Value $resourceIdSecret.value -------------------------------------------------------------------------------- /build/templates/run-self-contained-integration-tests.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | azureServiceConnection: '' 3 | 4 | jobs: 5 | - job: IntegrationTests 6 | displayName: 'Run integration tests' 7 | pool: 8 | vmImage: '$(Vm.Image)' 9 | steps: 10 | - task: DownloadPipelineArtifact@2 11 | displayName: 'Download build artifacts' 12 | inputs: 13 | artifact: 'Build' 14 | path: '$(Build.SourcesDirectory)' 15 | 16 | - task: UseDotNet@2 17 | displayName: 'Import .NET Core SDK ($(DotNet.Sdk.PreviousVersion))' 18 | inputs: 19 | packageType: 'sdk' 20 | version: '$(DotNet.Sdk.PreviousVersion)' 21 | 22 | - template: import-keyvault-secrets.yml 23 | parameters: 24 | azureServiceConnection: '${{ parameters.azureServiceConnection }}' 25 | 26 | - template: test/run-integration-tests.yml@templates 27 | parameters: 28 | dotnetSdkVersion: '$(DotNet.Sdk.Version)' 29 | includePreviewVersions: $(DotNet.Sdk.IncludePreviewVersions) 30 | projectName: '$(Project).Tests.Integration' 31 | category: 'Integration' -------------------------------------------------------------------------------- /build/templates/run-unit-tests.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: UnitTests 3 | displayName: 'Run unit tests' 4 | pool: 5 | vmImage: '$(Vm.Image)' 6 | steps: 7 | - task: DownloadPipelineArtifact@2 8 | displayName: 'Download build artifacts' 9 | inputs: 10 | artifact: 'Build' 11 | path: '$(Build.SourcesDirectory)' 12 | 13 | - task: UseDotNet@2 14 | displayName: 'Import .NET Core SDK ($(DotNet.Sdk.PreviousVersion))' 15 | inputs: 16 | packageType: 'sdk' 17 | version: '$(DotNet.Sdk.PreviousVersion)' 18 | 19 | - template: test/run-unit-tests.yml@templates 20 | parameters: 21 | dotnetSdkVersion: '$(DotNet.Sdk.Version)' 22 | includePreviewVersions: $(DotNet.Sdk.IncludePreviewVersions) 23 | projectName: '$(Project).Tests.Unit' -------------------------------------------------------------------------------- /build/variables/build.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | DotNet.Sdk.Version: '8.0.x' 3 | DotNet.Sdk.PreviousVersion: '6.0.100' 4 | DotNet.Sdk.IncludePreviewVersions: false 5 | Project: 'Arcus.Observability' 6 | Vm.Image: 'ubuntu-latest' 7 | -------------------------------------------------------------------------------- /build/variables/test.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | AzureFunctions.HttpPort: 5000 3 | Arcus.Observability.KeyVault.Name: 'arcus-observability-kv' 4 | Arcus.Observability.ApplicationInsights.InstrumentationKey.SecretName: 'ApplicationInsights-InstrumentationKey' 5 | Arcus.Observability.LogAnalytics.WorkspaceId.SecretName: 'LogAnalytics-WorkspaceId' -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. 4 | 5 | ## Prerequisites 6 | This documentation assumes that you run all scripts within the docs folder. 7 | 8 | ```console 9 | cd docs 10 | ``` 11 | 12 | 13 | ## Installation 14 | 15 | ```console 16 | npm install 17 | ``` 18 | 19 | ## Local Development 20 | 21 | ```console 22 | npm start 23 | ``` 24 | 25 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 26 | 27 | ## Versioning 28 | https://docusaurus.io/docs/versioning 29 | 30 | You can use the version script to create a new documentation version based on the latest content in the `./preview` directory. That specific set of documentation will then be preserved and accessible even as the documentation in the docs directory changes moving forward. 31 | 32 | ### Tagging a new version 33 | 34 | 1. First, make sure your content in the `./preview` directory is ready to be frozen as a version. A version always should be based from master. 35 | 2. Enter a new version number: 36 | `npm run docusaurus docs:version v1.1` 37 | 38 | 4. Update NuGet install statements to include `--version {version}`. This needs to be done in `01-index.md` & `02-Features/correlation.md`. 39 | 40 | #### What does tagging do? 41 | 42 | When tagging a new version, the document versioning mechanism will: 43 | 44 | - Copy the full `./preview` folder contents into a new `versioned_docs/version-/` folder. 45 | - Create a versioned sidebars file based from your current sidebar configuration (if it exists) - saved as `versioned_sidebars/version--sidebars.json`. 46 | - Append the new version number to `versions.json`. 47 | 48 | ## Syntax highlighting 49 | 50 | To have syntax highlighting within the codeblocks you have to use one of the prism supported languages: 51 | 52 | https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js 53 | ## Deploying to Netlify 54 | 55 | https://docusaurus.io/docs/deployment#deploying-to-netlify 56 | -------------------------------------------------------------------------------- /docs/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/docusaurus.build.config.js: -------------------------------------------------------------------------------- 1 | const buildConfig = require('./docusaurus.config'); 2 | 3 | module.exports = { 4 | ...buildConfig, 5 | themeConfig: { 6 | ...buildConfig.themeConfig, 7 | algolia: { 8 | appId: process.env.ALGOLIA_APP_ID, 9 | apiKey: process.env.ALGOLIA_API_KEY, 10 | indexName: 'arcus-azure', 11 | // Set `contextualSearch` to `true` when having multiple versions!!! 12 | contextualSearch: true, 13 | searchParameters: { 14 | facetFilters: ["tags:observability"] 15 | }, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "arcus-observability", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build --config ./docusaurus.build.config.js", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids" 15 | }, 16 | "dependencies": { 17 | "@docusaurus/core": "^2.0.1", 18 | "@docusaurus/preset-classic": "^2.0.1", 19 | "@docusaurus/theme-search-algolia": "^2.0.1", 20 | "@mdx-js/react": "^1.6.21", 21 | "@svgr/webpack": "^6.3.1", 22 | "clsx": "^1.1.1", 23 | "file-loader": "^6.2.0", 24 | "prism-react-renderer": "^1.2.1", 25 | "react": "^17.0.1", 26 | "react-dom": "^17.0.1", 27 | "url-loader": "^4.1.1" 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.5%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/preview/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry by making use of the common `ILogger` infrastructure to track dependencies, log custom metrics and log multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/preview/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | In certain scenarios, the cost of having too much telemetry or having a certain type of telemetry in your logging can be too high to be useful. We could, for example, filter out in container logs the Request, Metrics and Dependencies, and discard all the other types to make the logging output more readable and cost-effective. 19 | 20 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 21 | 22 | ```csharp 23 | using Arcus.Observability.Telemetry.Core; 24 | using Arcus.Observability.Telemetry.Serilog.Filters; 25 | using Serilog.Core; 26 | using Serilog.Configuration; 27 | 28 | ILogger logger = new LoggerConfiguration() 29 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 30 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 31 | .CreateLogger(); 32 | ``` 33 | 34 | The filter can also be used to reduce telemetry for multiple types by chaining them: 35 | 36 | ```csharp 37 | ILogger logger = new LoggerConfiguration() 38 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 39 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 40 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 41 | .CreateLogger(); 42 | ``` 43 | 44 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not: 45 | 46 | ```csharp 47 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 48 | ILogger logger = new LoggerConfiguration() 49 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 50 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 51 | .CreateLogger(); 52 | ``` 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creating a sidebar enables you to: 3 | - create an ordered group of docs 4 | - render a sidebar for each doc of that group 5 | - provide next/previous navigation 6 | 7 | The sidebars can be generated from the filesystem, or explicitly defined here. 8 | 9 | Create as many sidebars as you want. 10 | */ 11 | 12 | module.exports = { 13 | // By default, Docusaurus generates a sidebar from the docs folder structure 14 | tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], 15 | 16 | // But you can create a sidebar manually 17 | /* 18 | tutorialSidebar: [ 19 | { 20 | type: 'category', 21 | label: 'Tutorial', 22 | items: ['hello'], 23 | }, 24 | ], 25 | */ 26 | }; 27 | -------------------------------------------------------------------------------- /docs/src/pages/index.module.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/src/pages/index.module.css -------------------------------------------------------------------------------- /docs/src/prism/dark.js: -------------------------------------------------------------------------------- 1 | ('use strict'); 2 | 3 | // Original: https://github.com/sdras/night-owl-vscode-theme 4 | 5 | var theme = { 6 | plain: { 7 | color: '#e9edfa', 8 | backgroundColor: '#19203d', 9 | }, 10 | styles: [ 11 | { 12 | types: ['changed'], 13 | style: { 14 | color: 'rgb(162, 191, 252)', 15 | fontStyle: 'italic', 16 | }, 17 | }, 18 | { 19 | types: ['deleted'], 20 | style: { 21 | color: 'hsl(5, 74%, 69%)', 22 | fontStyle: 'italic', 23 | }, 24 | }, 25 | { 26 | types: ['inserted', 'attr-name'], 27 | style: { 28 | color: 'hsl(119, 34%, 67%)', 29 | fontStyle: 'italic', 30 | }, 31 | }, 32 | { 33 | types: ['comment'], 34 | style: { 35 | color: 'hsl(230, 4%, 74%)', 36 | fontStyle: 'italic', 37 | }, 38 | }, 39 | { 40 | types: ['string', 'url'], 41 | style: { 42 | color: 'hsl(119, 34%, 67%)', 43 | }, 44 | }, 45 | { 46 | types: ['variable'], 47 | style: { 48 | color: '#47acff', 49 | }, 50 | }, 51 | { 52 | types: ['number'], 53 | style: { 54 | color: 'hsl(35, 99%, 66%)', 55 | }, 56 | }, 57 | { 58 | types: ['builtin', 'char', 'constant', 'function', 'operator'], 59 | style: { 60 | color: '#47acff', 61 | }, 62 | }, 63 | { 64 | // This was manually added after the auto-generation 65 | // so that punctuations are not italicised 66 | types: ['punctuation'], 67 | style: { 68 | color: '#e9edfa', 69 | }, 70 | }, 71 | { 72 | types: ['selector', 'doctype'], 73 | style: { 74 | color: '#e9edfa', 75 | fontStyle: 'italic', 76 | }, 77 | }, 78 | { 79 | types: ['class-name'], 80 | style: { 81 | color: 'hsl(35, 99%, 66%)', 82 | }, 83 | }, 84 | { 85 | types: ['tag', 'keyword'], 86 | style: { 87 | color: 'hsl(301, 63%, 80%)', 88 | }, 89 | }, 90 | { 91 | types: ['boolean'], 92 | style: { 93 | color: 'hsl(35, 99%, 66%)', 94 | }, 95 | }, 96 | { 97 | types: ['property'], 98 | style: { 99 | color: 'hsl(5, 74%, 69%)', 100 | }, 101 | }, 102 | { 103 | types: ['namespace'], 104 | style: { 105 | opacity: 0.8, 106 | }, 107 | }, 108 | ], 109 | }; 110 | 111 | module.exports = theme; 112 | -------------------------------------------------------------------------------- /docs/src/prism/light.js: -------------------------------------------------------------------------------- 1 | ('use strict'); 2 | 3 | // Original: https://github.com/sdras/night-owl-vscode-theme 4 | 5 | var theme = { 6 | plain: { 7 | color: '#19203d', 8 | backgroundColor: '#f6f8fa', 9 | }, 10 | styles: [ 11 | { 12 | types: ['changed'], 13 | style: { 14 | color: 'rgb(162, 191, 252)', 15 | fontStyle: 'italic', 16 | }, 17 | }, 18 | { 19 | types: ['deleted'], 20 | style: { 21 | color: 'hsl(5, 74%, 59%)', 22 | fontStyle: 'italic', 23 | }, 24 | }, 25 | { 26 | types: ['inserted', 'attr-name'], 27 | style: { 28 | color: 'hsl(119, 34%, 47%)', 29 | fontStyle: 'italic', 30 | }, 31 | }, 32 | { 33 | types: ['comment'], 34 | style: { 35 | color: 'hsl(230, 4%, 64%)', 36 | fontStyle: 'italic', 37 | }, 38 | }, 39 | { 40 | types: ['string', 'url'], 41 | style: { 42 | color: 'hsl(119, 34%, 47%)', 43 | }, 44 | }, 45 | { 46 | types: ['variable'], 47 | style: { 48 | color: '#249cff', 49 | }, 50 | }, 51 | { 52 | types: ['number'], 53 | style: { 54 | color: 'hsl(35, 99%, 36%)', 55 | }, 56 | }, 57 | { 58 | types: ['builtin', 'char', 'constant', 'function', 'operator'], 59 | style: { 60 | color: '#249cff', 61 | }, 62 | }, 63 | { 64 | // This was manually added after the auto-generation 65 | // so that punctuations are not italicised 66 | types: ['punctuation'], 67 | style: { 68 | color: '#19203d', 69 | }, 70 | }, 71 | { 72 | types: ['selector', 'doctype'], 73 | style: { 74 | color: '#19203d', 75 | fontStyle: 'italic', 76 | }, 77 | }, 78 | { 79 | types: ['class-name'], 80 | style: { 81 | color: 'hsl(35, 99%, 36%)', 82 | }, 83 | }, 84 | { 85 | types: ['tag', 'keyword'], 86 | style: { 87 | color: 'hsl(301, 63%, 40%)', 88 | }, 89 | }, 90 | { 91 | types: ['boolean'], 92 | style: { 93 | color: 'hsl(35, 99%, 36%)', 94 | }, 95 | }, 96 | { 97 | types: ['property'], 98 | style: { 99 | color: 'hsl(5, 74%, 59%)', 100 | }, 101 | }, 102 | { 103 | types: ['namespace'], 104 | style: { 105 | opacity: 0.8, 106 | }, 107 | }, 108 | ], 109 | }; 110 | 111 | module.exports = theme; 112 | -------------------------------------------------------------------------------- /docs/static/img/arcus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/arcus.jpg -------------------------------------------------------------------------------- /docs/static/img/arcus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/arcus.png -------------------------------------------------------------------------------- /docs/static/img/arcus_for_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/arcus_for_dark.png -------------------------------------------------------------------------------- /docs/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/favicon.ico -------------------------------------------------------------------------------- /docs/static/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/icon.png -------------------------------------------------------------------------------- /docs/static/img/logger-arcus-appinsights.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/img/logger-arcus-appinsights.png -------------------------------------------------------------------------------- /docs/static/media/http-correlation-w3c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/http-correlation-w3c.png -------------------------------------------------------------------------------- /docs/static/media/http-correlation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/http-correlation.png -------------------------------------------------------------------------------- /docs/static/media/multi-dimensional-metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/multi-dimensional-metrics.png -------------------------------------------------------------------------------- /docs/static/media/product-stock-api-service-correlation-example-applicationmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/product-stock-api-service-correlation-example-applicationmap.png -------------------------------------------------------------------------------- /docs/static/media/product-stock-api-service-correlation-example-transactionsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/product-stock-api-service-correlation-example-transactionsearch.png -------------------------------------------------------------------------------- /docs/static/media/product-stock-api-service-w3c-correlation-example-transactionsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/product-stock-api-service-w3c-correlation-example-transactionsearch.png -------------------------------------------------------------------------------- /docs/static/media/service-to-service-api-worker-diagram-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/service-to-service-api-worker-diagram-example.png -------------------------------------------------------------------------------- /docs/static/media/service-to-service-api-worker-w3c-diagram-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/service-to-service-api-worker-w3c-diagram-example.png -------------------------------------------------------------------------------- /docs/static/media/service-to-service-correlation-application-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/service-to-service-correlation-application-map.png -------------------------------------------------------------------------------- /docs/static/media/service-to-service-correlation-relationship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/service-to-service-correlation-relationship.png -------------------------------------------------------------------------------- /docs/static/media/servicebus-worker-service-correlation-example-applicationmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/servicebus-worker-service-correlation-example-applicationmap.png -------------------------------------------------------------------------------- /docs/static/media/servicebus-worker-service-correlation-example-transactionsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/servicebus-worker-service-correlation-example-transactionsearch.png -------------------------------------------------------------------------------- /docs/static/media/servicebus-worker-service-w3c-correlation-example-applicationmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/servicebus-worker-service-w3c-correlation-example-applicationmap.png -------------------------------------------------------------------------------- /docs/static/media/servicebus-worker-service-w3c-correlation-example-transactionsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/servicebus-worker-service-w3c-correlation-example-transactionsearch.png -------------------------------------------------------------------------------- /docs/static/media/single-dimensional-metric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcus-azure/arcus.observability/c2f4c7e42d423141d7d85a19892778f255faca73/docs/static/media/single-dimensional-metric.png -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=0.1.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/0.1.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation -Version 0.1.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 23 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 24 | - Telemetry 25 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 26 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 27 | - Sinks 28 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 29 | 30 | # License 31 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 32 | 33 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 34 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.0/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights -Version 0.1.0 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.0/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters -Version 0.1.0 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.1/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=0.1.1)](https://www.nuget.org/packages/Arcus.Observability.Correlation/0.1.1) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation -Version 0.1.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 23 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 24 | - Telemetry 25 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 26 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 27 | - Sinks 28 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 29 | 30 | # License 31 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 32 | 33 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 34 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.1/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights -Version 0.1.1 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.1.1/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters -Version 0.1.1 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.2.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=0.2.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/0.2.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation -Version 0.2.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # License 32 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 33 | 34 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 35 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.2.0/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights -Version 0.2.0 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.2.0/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.3/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=0.3.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/0.3.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.3/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.3/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.4/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=0.4.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/0.4.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.4/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | ## FAQ 45 | 46 | ### Q: Why is it mandatory to provide an instrumentation key? 47 | 48 | While the native Azure Application Insights SDK does not enforce an instrumentation key we have chosen to make it mandatory to provide one. 49 | 50 | By doing this, we allow you to fail fast and avoid running your application with a misconfigured telemetry setup. If it would be optional, you could have it running for days/weeks only to notice you are not sending any telemetry when everything is on fire and you are in the dark. 51 | 52 | If you want to optionally use our sink when there is an instrumentation key, we recommend using this simple pattern: 53 | 54 | ```csharp 55 | using Serilog; 56 | using Serilog.Configuration; 57 | 58 | var loggerConfig = new LoggerConfiguration() 59 | .MinimumLevel.Debug(); 60 | 61 | if(string.IsNullOrEmpty(key) == false) 62 | { 63 | loggerConfig.WriteTo.AzureApplicationInsights(key); 64 | } 65 | 66 | ILogger logger = loggerConfig.CreateLogger(); 67 | ``` 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v0.4/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v1.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=1.0.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/1.0.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation -Version 1.0.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v1.0/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | ## FAQ 45 | 46 | ### Q: Why is it mandatory to provide an instrumentation key? 47 | 48 | While the native Azure Application Insights SDK does not enforce an instrumentation key we have chosen to make it mandatory to provide one. 49 | 50 | By doing this, we allow you to fail fast and avoid running your application with a misconfigured telemetry setup. If it would be optional, you could have it running for days/weeks only to notice you are not sending any telemetry when everything is on fire and you are in the dark. 51 | 52 | If you want to optionally use our sink when there is an instrumentation key, we recommend using this simple pattern: 53 | 54 | ```csharp 55 | using Serilog; 56 | using Serilog.Configuration; 57 | 58 | var loggerConfig = new LoggerConfiguration() 59 | .MinimumLevel.Debug(); 60 | 61 | if(string.IsNullOrEmpty(key) == false) 62 | { 63 | loggerConfig.WriteTo.AzureApplicationInsights(key); 64 | } 65 | 66 | ILogger logger = loggerConfig.CreateLogger(); 67 | ``` 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v1.0/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=2.0.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/2.0.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation --Version 2.0.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.0/02-Features/sinks/azure-application-insights.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Azure Application Insights Sink" 3 | layout: default 4 | --- 5 | 6 | # Azure Application Insights Sink 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights 14 | ``` 15 | 16 | ## What is it? 17 | 18 | The Azure Application Insights sink is an extension of the [official Application Insights sink](https://www.nuget.org/packages/Serilog.Sinks.ApplicationInsights/) that allows you to not only emit traces or events, but the whole Application Insights suite of telemetry types - Traces, Dependencies, Events, Requests & Metrics. 19 | 20 | You can easily configure the sink by providing the Azure Application Insights key: 21 | 22 | ```csharp 23 | using Serilog; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .MinimumLevel.Debug() 28 | .WriteTo.AzureApplicationInsights("") 29 | .CreateLogger(); 30 | ``` 31 | 32 | Alternatively, you can override the default minimum log level to reduce amount of telemetry being tracked : 33 | 34 | ```csharp 35 | using Serilog; 36 | using Serilog.Configuration; 37 | 38 | ILogger logger = new LoggerConfiguration() 39 | .MinimumLevel.Debug() 40 | .WriteTo.AzureApplicationInsights("", restrictedToMinimumLevel: LogEventLevel.Warning) 41 | .CreateLogger(); 42 | ``` 43 | 44 | ## FAQ 45 | 46 | ### Q: Why is it mandatory to provide an instrumentation key? 47 | 48 | While the native Azure Application Insights SDK does not enforce an instrumentation key we have chosen to make it mandatory to provide one. 49 | 50 | By doing this, we allow you to fail fast and avoid running your application with a misconfigured telemetry setup. If it would be optional, you could have it running for days/weeks only to notice you are not sending any telemetry when everything is on fire and you are in the dark. 51 | 52 | If you want to optionally use our sink when there is an instrumentation key, we recommend using this simple pattern: 53 | 54 | ```csharp 55 | using Serilog; 56 | using Serilog.Configuration; 57 | 58 | var loggerConfig = new LoggerConfiguration() 59 | .MinimumLevel.Debug(); 60 | 61 | if(string.IsNullOrEmpty(key) == false) 62 | { 63 | loggerConfig.WriteTo.AzureApplicationInsights(key); 64 | } 65 | 66 | ILogger logger = loggerConfig.CreateLogger(); 67 | ``` 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.0/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.1/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=2.1.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/2.1.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation --Version 2.1.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.1/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.2/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?packageVersion=2.2.0)](https://www.nuget.org/packages/Arcus.Observability.Correlation/2.2.0) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation --Version 2.2.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.2/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.3/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?includePreReleases=true)](https://www.nuget.org/packages/Arcus.Observability.Correlation/) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation --version 2.3.0 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in .NET Core and/or Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.3/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.4/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | [![NuGet Badge](https://buildstats.info/nuget/Arcus.Observability.Correlation?includePreReleases=true)](https://www.nuget.org/packages/Arcus.Observability.Correlation/) 9 | 10 | # Installation 11 | 12 | The Arcus.Observability.Correlation package can be installed via NuGet: 13 | 14 | ```shell 15 | PM > Install-Package Arcus.Observability.Correlation 16 | ``` 17 | 18 | For more granular packages we recommend reading the documentation. 19 | 20 | # Features 21 | 22 | - [Making telemetry more powerful](./02-Features/making-telemetry-more-powerful.md) by making it simple to provide contextual information 23 | - [Writing different telemetry types](./02-Features/writing-different-telemetry-types.md) - Go beyond logs with our `ILogger` extensions for Dependencies, Events, Requests & Metrics. 24 | - [Correlation](./02-Features/correlation.md) - A common set of correlation levels. 25 | - Telemetry 26 | - [Enrichment](./02-Features/telemetry-enrichment.md) - A set of enrichers to improve telemetry information. 27 | - [Filters](./02-Features/telemetry-filter.md) - A set of filters to control telemetry flow with. 28 | - Sinks 29 | - [Azure Application Insights](./02-Features/sinks/azure-application-insights.md) - Flow Traces, Dependencies, Events, Requests & Metrics information to Azure Application Insights 30 | 31 | # Guidance 32 | 33 | - [Using Arcus & Serilog in Azure Functions](./03-Guidance/use-with-dotnet-and-functions.md) 34 | 35 | # License 36 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 37 | 38 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 39 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.4/02-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.5.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry. Instead of managing logging, correlation, tracking, Arcus Observability allows you to work with the common `ILogger` infrastructure and still be able to write multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.5.0/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.6.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry by making use of the common `ILogger` infrastructure to track dependencies, log custom metrics and log multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.6.0/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 19 | 20 | ```csharp 21 | using Arcus.Observability.Telemetry.Core; 22 | using Arcus.Observability.Telemetry.Serilog.Filters; 23 | using Serilog.Core; 24 | using Serilog.Configuration; 25 | 26 | ILogger logger = new LoggerConfiguration() 27 | .WriteTo.AzureApplicationInsights("") 28 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 29 | .CreateLogger(); 30 | ``` 31 | 32 | The filter can also be used to reduce telemetry for multiple types by chaining them: 33 | 34 | ```csharp 35 | ILogger logger = new LoggerConfiguration() 36 | .WriteTo.AzureApplicationInsights("") 37 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 38 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 39 | .CreateLogger(); 40 | ``` 41 | 42 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not : 43 | 44 | ```csharp 45 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 46 | ILogger logger = new LoggerConfiguration() 47 | .WriteTo.AzureApplicationInsights("") 48 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 49 | .CreateLogger(); 50 | ``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.7.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry by making use of the common `ILogger` infrastructure to track dependencies, log custom metrics and log multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.7.0/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | In certain scenarios, the cost of having too much telemetry or having a certain type of telemetry in your logging can be too high to be useful. We could, for example, filter out in container logs the Request, Metrics and Dependencies, and discard all the other types to make the logging output more readable and cost-effective. 19 | 20 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 21 | 22 | ```csharp 23 | using Arcus.Observability.Telemetry.Core; 24 | using Arcus.Observability.Telemetry.Serilog.Filters; 25 | using Serilog.Core; 26 | using Serilog.Configuration; 27 | 28 | ILogger logger = new LoggerConfiguration() 29 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 30 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 31 | .CreateLogger(); 32 | ``` 33 | 34 | The filter can also be used to reduce telemetry for multiple types by chaining them: 35 | 36 | ```csharp 37 | ILogger logger = new LoggerConfiguration() 38 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 39 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 40 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 41 | .CreateLogger(); 42 | ``` 43 | 44 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not: 45 | 46 | ```csharp 47 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 48 | ILogger logger = new LoggerConfiguration() 49 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 50 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 51 | .CreateLogger(); 52 | ``` 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.8.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry by making use of the common `ILogger` infrastructure to track dependencies, log custom metrics and log multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v2.8.0/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | In certain scenarios, the cost of having too much telemetry or having a certain type of telemetry in your logging can be too high to be useful. We could, for example, filter out in container logs the Request, Metrics and Dependencies, and discard all the other types to make the logging output more readable and cost-effective. 19 | 20 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 21 | 22 | ```csharp 23 | using Arcus.Observability.Telemetry.Core; 24 | using Arcus.Observability.Telemetry.Serilog.Filters; 25 | using Serilog.Core; 26 | using Serilog.Configuration; 27 | 28 | ILogger logger = new LoggerConfiguration() 29 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 30 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 31 | .CreateLogger(); 32 | ``` 33 | 34 | The filter can also be used to reduce telemetry for multiple types by chaining them: 35 | 36 | ```csharp 37 | ILogger logger = new LoggerConfiguration() 38 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 39 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 40 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 41 | .CreateLogger(); 42 | ``` 43 | 44 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not: 45 | 46 | ```csharp 47 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 48 | ILogger logger = new LoggerConfiguration() 49 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 50 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 51 | .CreateLogger(); 52 | ``` 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v3.0.0/01-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Arcus Observability" 3 | layout: default 4 | slug: / 5 | sidebar_label: Welcome 6 | --- 7 | 8 | # Introduction 9 | 10 | Arcus Observability allows you to work easily with Azure Application Insights telemetry by making use of the common `ILogger` infrastructure to track dependencies, log custom metrics and log multi-dimensional telemetry data. The library supports multiple telemetry types like tracking dependencies, requests, events, metrics, while also be able to filter with Serilog filters and enrich with custom correlation. 11 | 12 | ![Logger Arcus - Application Insights](/img/logger-arcus-appinsights.png) 13 | 14 | # Guidance 15 | 16 | - [Using Arcus & Serilog in ASP.NET Core](./02-Guidance/use-with-dotnet-and-aspnetcore.md) 17 | - [Using Arcus & Serilog in Azure Functions](./02-Guidance/use-with-dotnet-and-functions.md) 18 | 19 | # Installation 20 | 21 | The Arcus.Observability.Correlation package can be installed via NuGet: 22 | 23 | ```shell 24 | PM > Install-Package Arcus.Observability.Serilog.Sinks.ApplicationInsights 25 | ``` 26 | 27 | For more granular packages we recommend reading [the documentation](./03-Features/sinks/azure-application-insights.md). 28 | 29 | # License 30 | This is licensed under The MIT License (MIT). Which means that you can use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the web application. But you always need to state that Codit is the original author of this web application. 31 | 32 | *[Full license here](https://github.com/arcus-azure/arcus.observability/blob/master/LICENSE)* 33 | -------------------------------------------------------------------------------- /docs/versioned_docs/version-v3.0.0/03-Features/telemetry-filter.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Telemetry Filters" 3 | layout: default 4 | --- 5 | 6 | # Telemetry Filters 7 | 8 | ## Installation 9 | 10 | This feature requires to install our NuGet package 11 | 12 | ```shell 13 | PM > Install-Package Arcus.Observability.Telemetry.Serilog.Filters 14 | ``` 15 | 16 | ## Telemetry Type Filter 17 | 18 | In certain scenarios, the cost of having too much telemetry or having a certain type of telemetry in your logging can be too high to be useful. We could, for example, filter out in container logs the Request, Metrics and Dependencies, and discard all the other types to make the logging output more readable and cost-effective. 19 | 20 | This [Serilog filter](https://github.com/serilog/serilog/wiki/Enrichment) allows you to filter out different a specific type of telemetry. 21 | 22 | ```csharp 23 | using Arcus.Observability.Telemetry.Core; 24 | using Arcus.Observability.Telemetry.Serilog.Filters; 25 | using Serilog.Core; 26 | using Serilog.Configuration; 27 | 28 | ILogger logger = new LoggerConfiguration() 29 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 30 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 31 | .CreateLogger(); 32 | ``` 33 | 34 | The filter can also be used to reduce telemetry for multiple types by chaining them: 35 | 36 | ```csharp 37 | ILogger logger = new LoggerConfiguration() 38 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 39 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Events)) 40 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency)) 41 | .CreateLogger(); 42 | ``` 43 | 44 | Alternatively, you can explicitly specify if it should track telemetry or not based on the application configuration has to be tracked or not: 45 | 46 | ```csharp 47 | var trackDependencies = configuration["telemetry:dependencies:isEnabled"]; 48 | ILogger logger = new LoggerConfiguration() 49 | .WriteTo.AzureApplicationInsightsWithConnectionString("") 50 | .Filter.With(TelemetryTypeFilter.On(TelemetryType.Dependency, isTrackingEnabled: bool.Parse(trackDependencies))) 51 | .CreateLogger(); 52 | ``` 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v0.1.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v0.1.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v0.1.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v0.1.1/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v0.2.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v0.2.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v0.3-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v0.3/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v0.4-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v0.4/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v1.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v1.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.1/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.2-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.2/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.3-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.3/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.4-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.4/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.5.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.5.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.6.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.6.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.7.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.7.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v2.8.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v2.8.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versioned_sidebars/version-v3.0.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-v3.0.0/tutorialSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /docs/versions.json: -------------------------------------------------------------------------------- 1 | [ 2 | "v3.0.0", 3 | "v2.8.0", 4 | "v2.7.0", 5 | "v2.6.0", 6 | "v2.5.0", 7 | "v2.4", 8 | "v2.3", 9 | "v2.2", 10 | "v2.1", 11 | "v2.0", 12 | "v1.0", 13 | "v0.4", 14 | "v0.3", 15 | "v0.2.0", 16 | "v0.1.1", 17 | "v0.1.0" 18 | ] 19 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [Settings] 2 | # Added automatically by the Netlify CLI. It has no effect during normal 3 | # Git-backed deploys. 4 | ID = "399593f6-4357-4b76-ac22-850f629d1135" 5 | 6 | # Settings in the [build] context are global and are applied to all contexts 7 | # unless otherwise overridden by more specific contexts. 8 | [build] 9 | # Directory to change to before starting a build. 10 | # This is where we will look for package.json/.nvmrc/etc. 11 | base = "docs" 12 | 13 | # Directory (relative to root of your repo) that contains the deploy-ready 14 | # HTML files and assets generated by the build. 15 | publish = "build" 16 | 17 | # Default build command. 18 | command = "npm run build" 19 | 20 | # Directory with the lambda functions to deploy to AWS. 21 | # functions = "project/functions/" 22 | 23 | [build.environment] 24 | NODE_VERSION = "16.14" 25 | 26 | # Production context: all deploys from the Production branch set in your site's 27 | # deploy settings will inherit these settings. 28 | # [context.production] 29 | # publish = "output/" 30 | # command = "make publish" 31 | # environment = { ACCESS_TOKEN = "super secret", NODE_ENV = "8.0.1" } 32 | 33 | # Deploy Preview context: all deploys resulting from a pull/merge request will 34 | # inherit these settings. 35 | # [context.deploy-preview] 36 | # publish = "dist/" 37 | -------------------------------------------------------------------------------- /src/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/Arcus.Observability.Correlation.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to use correlation in applications 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Correlation 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/CorrelationInfoAccessorProxy.cs: -------------------------------------------------------------------------------- 1 | using GuardNet; 2 | 3 | namespace Arcus.Observability.Correlation 4 | { 5 | /// 6 | /// Internal proxy implementation to register an as an . 7 | /// 8 | /// The custom model. 9 | internal class CorrelationInfoAccessorProxy : ICorrelationInfoAccessor 10 | where TCorrelationInfo : CorrelationInfo 11 | { 12 | private readonly ICorrelationInfoAccessor _correlationInfoAccessor; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | internal CorrelationInfoAccessorProxy(ICorrelationInfoAccessor correlationInfoAccessor) 18 | { 19 | Guard.NotNull(correlationInfoAccessor, nameof(correlationInfoAccessor)); 20 | 21 | _correlationInfoAccessor = correlationInfoAccessor; 22 | } 23 | 24 | /// 25 | /// Gets the current correlation information initialized in this context. 26 | /// 27 | public CorrelationInfo GetCorrelationInfo() 28 | { 29 | return _correlationInfoAccessor.GetCorrelationInfo(); 30 | } 31 | 32 | /// 33 | /// Sets the current correlation information for this context. 34 | /// 35 | /// The correlation model to set. 36 | public void SetCorrelationInfo(CorrelationInfo correlationInfo) 37 | { 38 | if (correlationInfo is TCorrelationInfo typedCorrelationInfo) 39 | { 40 | _correlationInfoAccessor.SetCorrelationInfo(typedCorrelationInfo); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/DefaultCorrelationInfoAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Correlation 2 | { 3 | /// 4 | /// Default implementation to access the in the current context. 5 | /// 6 | public class DefaultCorrelationInfoAccessor : DefaultCorrelationInfoAccessor, ICorrelationInfoAccessor 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/DefaultCorrelationInfoAccessorT.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | namespace Arcus.Observability.Correlation 4 | { 5 | /// 6 | /// Default implementation to access the in the current context. 7 | /// 8 | public class DefaultCorrelationInfoAccessor : ICorrelationInfoAccessor 9 | where TCorrelationInfo : CorrelationInfo 10 | { 11 | private TCorrelationInfo _correlationInfo; 12 | 13 | /// 14 | /// Gets the current correlation information initialized in this context. 15 | /// 16 | public TCorrelationInfo GetCorrelationInfo() 17 | { 18 | return _correlationInfo; 19 | } 20 | 21 | /// 22 | /// Sets the current correlation information for this context. 23 | /// 24 | /// The correlation model to set. 25 | public void SetCorrelationInfo(TCorrelationInfo correlationInfo) 26 | { 27 | Interlocked.Exchange(ref _correlationInfo, correlationInfo); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/ICorrelationInfoAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Correlation 2 | { 3 | /// 4 | /// Represents a contract to access the model. 5 | /// 6 | public interface ICorrelationInfoAccessor : ICorrelationInfoAccessor 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Correlation/ICorrelationInfoAccessorT.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Correlation 2 | { 3 | /// 4 | /// Represents a contract to access the model. 5 | /// 6 | public interface ICorrelationInfoAccessor 7 | where TCorrelationInfo : CorrelationInfo 8 | { 9 | /// 10 | /// Gets the current correlation information initialized in this context. 11 | /// 12 | TCorrelationInfo GetCorrelationInfo(); 13 | 14 | /// 15 | /// Sets the current correlation information for this context. 16 | /// 17 | /// The correlation model to set. 18 | void SetCorrelationInfo(TCorrelationInfo correlationInfo); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.AspNetCore/Arcus.Observability.Telemetry.AspNetCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to improve ASP.NET Core telemetry with Serilog in applications 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Telemetry;Serilog;ASP.NET;Core 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Arcus.Observability.Telemetry.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to improve telemetry with Serilog in applications 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Telemetry;Serilog 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/DefaultAppName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GuardNet; 3 | 4 | namespace Arcus.Observability.Telemetry.Core 5 | { 6 | /// 7 | /// Default implementation that uses a static name to set as application name. 8 | /// 9 | public class DefaultAppName : IAppName 10 | { 11 | private readonly string _componentName; 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// The functional name to identity the application. 17 | /// Thrown when the is blank. 18 | public DefaultAppName(string componentName) 19 | { 20 | Guard.NotNullOrWhitespace(componentName, nameof(componentName), "Requires a non-blank functional name to identity the application"); 21 | _componentName = componentName; 22 | } 23 | 24 | /// 25 | /// Represents a way to retrieve the name of an application during the enrichment. 26 | /// 27 | public string GetApplicationName() 28 | { 29 | return _componentName; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/DurationMeasurement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace Arcus.Observability.Telemetry.Core 5 | { 6 | /// 7 | /// Represents an instance to measure easily telemetry in an application. 8 | /// 9 | public class DurationMeasurement : IDisposable 10 | { 11 | private readonly Stopwatch _stopwatch; 12 | 13 | private DurationMeasurement() 14 | { 15 | _stopwatch = Stopwatch.StartNew(); 16 | StartTime = DateTimeOffset.UtcNow; 17 | } 18 | 19 | /// 20 | /// Starts measuring a request until the measurement is disposed. 21 | /// 22 | public static DurationMeasurement Start() 23 | { 24 | return new DurationMeasurement(); 25 | } 26 | 27 | /// 28 | /// Gets the time when the measurement was started. 29 | /// 30 | public DateTimeOffset StartTime { get; } 31 | 32 | /// 33 | /// Gets the total elapsed time measured for the telemetry. 34 | /// 35 | public TimeSpan Elapsed => _stopwatch.Elapsed; 36 | 37 | /// 38 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 39 | /// 40 | public void Dispose() 41 | { 42 | _stopwatch.Stop(); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Extensions/IReadOnlyDictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using GuardNet; 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace System.Collections.Generic 5 | { 6 | /// 7 | /// Extensions on the to get more easily access to the the items' values. 8 | /// 9 | // ReSharper disable once InconsistentNaming 10 | public static class IReadOnlyDictionaryExtensions 11 | { 12 | /// 13 | /// Provides value or default for a given dictionary entry 14 | /// 15 | /// Dictionary containing data 16 | /// Key of the dictionary entry to return 17 | public static TValue GetValueOrDefault(this IReadOnlyDictionary dictionary, string propertyKey) 18 | { 19 | Guard.NotNull(dictionary, nameof(dictionary)); 20 | 21 | if (dictionary.TryGetValue(propertyKey, out TValue foundValue)) 22 | { 23 | return foundValue; 24 | } 25 | 26 | return default; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Extensions/ServiceBusEntityType.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable once CheckNamespace 2 | namespace Microsoft.Extensions.Logging 3 | { 4 | /// 5 | /// Corresponds with the type of the dependency type when logging an Azure Service Bus dependency. 6 | /// 7 | public enum ServiceBusEntityType 8 | { 9 | /// 10 | /// Sets the dependency type to a unknown entity. 11 | /// 12 | Unknown = 0, 13 | 14 | /// 15 | /// Sets the dependency type to a queue. 16 | /// 17 | Queue = 1, 18 | 19 | /// 20 | /// Sets the dependency type to a topic. 21 | /// 22 | Topic = 2, 23 | } 24 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/FormatSpecifiers.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core 2 | { 3 | /// 4 | /// Represents the all formatting used when logging telemetry instances. 5 | /// 6 | public static class FormatSpecifiers 7 | { 8 | /// 9 | /// A format specifier for converting DateTimeOffset instances to a string representation 10 | /// using the highest precision that is available. 11 | /// 12 | public static string InvariantTimestampFormat { get; } = "yyyy-MM-ddTHH:mm:ss.fffffff zzz"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/IAppName.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core 2 | { 3 | /// 4 | /// Represents a way to retrieve the name of an application during the enrichment. 5 | /// 6 | public interface IAppName 7 | { 8 | /// 9 | /// Represents a way to retrieve the name of an application during the enrichment. 10 | /// 11 | string GetApplicationName(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/IAppVersion.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core 2 | { 3 | /// 4 | /// Represents a way to retrieve the version of an application during the enrichment. 5 | /// 6 | public interface IAppVersion 7 | { 8 | /// 9 | /// Gets the current version of the application. 10 | /// 11 | string GetVersion(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Iot/IotHubConnectionStringParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using GuardNet; 4 | 5 | namespace Arcus.Observability.Telemetry.Core.Iot 6 | { 7 | /// 8 | /// Represents the instance to parse the IoT Hub connection string to a strongly-typed . 9 | /// 10 | internal static class IotHubConnectionStringParser 11 | { 12 | /// 13 | /// Parses the incoming IoT Hub to a strongly-typed result of IoT Hub properties. 14 | /// 15 | /// The connection string based on the hostname of the IoT Hub service. 16 | /// Thrown when the is blank. 17 | internal static IotHubConnectionStringParserResult Parse(string connectionString) 18 | { 19 | Guard.NotNullOrWhitespace(connectionString, nameof(connectionString), "Requires a non-blank connection string based on the hostname of the IoT Hub service"); 20 | 21 | string hostNameProperty = 22 | connectionString.Split(';', StringSplitOptions.RemoveEmptyEntries) 23 | .FirstOrDefault(part => part.StartsWith("HostName", StringComparison.OrdinalIgnoreCase)); 24 | 25 | if (hostNameProperty is null) 26 | { 27 | throw new FormatException( 28 | "Cannot parse IoT Hub connection string because cannot find 'HostName' in IoT Hub connection string"); 29 | } 30 | 31 | string hostName = 32 | string.Join("", hostNameProperty.SkipWhile(ch => ch != '=').Skip(1)); 33 | 34 | return new IotHubConnectionStringParserResult(hostName); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Iot/IotHubConnectionStringParserResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GuardNet; 3 | 4 | namespace Arcus.Observability.Telemetry.Core.Iot 5 | { 6 | /// 7 | /// Represents the result of the when parsing an IoT Hub connection string. 8 | /// 9 | internal class IotHubConnectionStringParserResult 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The fully-qualified DNS hostname of the IoT Hub service. 15 | /// Thrown when the is blank. 16 | internal IotHubConnectionStringParserResult(string hostName) 17 | { 18 | Guard.NotNullOrWhitespace(hostName, nameof(hostName), "Requires a non-blank fully-qualified DNS hostname of the IoT Hub service"); 19 | HostName = hostName; 20 | } 21 | 22 | /// 23 | /// Gets the value of the fully-qualified DNS hostname of the IoT Hub service. 24 | /// 25 | internal string HostName { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Logging/EventLogEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using GuardNet; 5 | 6 | namespace Arcus.Observability.Telemetry.Core.Logging 7 | { 8 | /// 9 | /// Represents an event as a log entry. 10 | /// 11 | public class EventLogEntry 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// The name of the event. 17 | /// The context that provides more insights on the event that occurred. 18 | /// Thrown when the is blank. 19 | public EventLogEntry(string name, IDictionary context) 20 | { 21 | Guard.NotNullOrWhitespace(name, nameof(name), "Requires a non-blank event name to track an custom event"); 22 | 23 | EventName = name; 24 | Context = context ?? new Dictionary(); 25 | Context[ContextProperties.General.TelemetryType] = TelemetryType.Events; 26 | } 27 | 28 | /// 29 | /// Gets the name of the event. 30 | /// 31 | public string EventName { get; } 32 | 33 | /// 34 | /// Gets the context that provides more insights on the event that occurred. 35 | /// 36 | public IDictionary Context { get; } 37 | 38 | /// 39 | /// Returns a string that represents the current object. 40 | /// 41 | /// A string that represents the current object. 42 | public override string ToString() 43 | { 44 | string contextFormatted = $"{{{String.Join("; ", Context.Select(item => $"[{item.Key}, {item.Value}]"))}}}"; 45 | return $"{EventName} (Context: {contextFormatted})"; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/Logging/RequestSourceSystem.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core.Logging 2 | { 3 | /// 4 | /// Represents the system from where the request came from. 5 | /// 6 | public enum RequestSourceSystem 7 | { 8 | /// 9 | /// Specifies that the request-source is an Azure Service Bus queue or topic. 10 | /// 11 | AzureServiceBus = 1, 12 | 13 | /// 14 | /// Specifies that the request-source is a HTTP request 15 | /// 16 | Http = 2, 17 | 18 | /// 19 | /// Specifies that the request-source is an Azure EventHubs. 20 | /// 21 | AzureEventHubs = 4, 22 | 23 | /// 24 | /// Specifies that the request-source is a custom system. 25 | /// 26 | Custom = 8 27 | } 28 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/MessageFormats.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core 2 | { 3 | /// 4 | /// Represents the publicly available message formats to track telemetry. 5 | /// 6 | public static class MessageFormats 7 | { 8 | /// 9 | /// Gets the message format to log external dependencies; compatible with Application Insights 'Dependencies'. 10 | /// 11 | public const string DependencyFormat = "{@" + ContextProperties.DependencyTracking.DependencyLogEntry + "}"; 12 | 13 | /// 14 | /// Gets the message format to log HTTP dependencies; compatible with Application Insights 'Dependencies'. 15 | /// 16 | public const string HttpDependencyFormat = "{@" + ContextProperties.DependencyTracking.DependencyLogEntry + "}"; 17 | 18 | /// 19 | /// Gets the message format to log SQL dependencies; compatible with Application Insights 'Dependencies'. 20 | /// 21 | public const string SqlDependencyFormat = "{@" + ContextProperties.DependencyTracking.DependencyLogEntry + "}"; 22 | 23 | /// 24 | /// Gets the message format to log events; compatible with Application Insights 'Events'. 25 | /// 26 | public const string EventFormat = "{@" + ContextProperties.EventTracking.EventLogEntry + "}"; 27 | 28 | /// 29 | /// Gets the message format to log metrics; compatible with Application Insights 'Metrics'. 30 | /// 31 | public const string MetricFormat = "{@" + ContextProperties.MetricTracking.MetricLogEntry + "}"; 32 | 33 | /// 34 | /// Gets the message format to log HTTP requests; compatible with Application Insights 'Requests'. 35 | /// 36 | public const string RequestFormat = "{@" + ContextProperties.RequestTracking.RequestLogEntry + "}"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/MessagePrefixes.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Core 2 | { 3 | /// 4 | /// Represents all the log message prefixes that are prepended when an telemetry instance gets logged. 5 | /// 6 | public static class MessagePrefixes 7 | { 8 | /// 9 | /// Gets the log message prefix when logging Azure Application Insights HTTP dependencies. 10 | /// 11 | public const string DependencyViaHttp = "HTTP Dependency"; 12 | 13 | /// 14 | /// Gets the log message prefix when logging Azure Application Insights SQL dependencies. 15 | /// 16 | public const string DependencyViaSql = "SQL Dependency"; 17 | 18 | /// 19 | /// Gets the log message prefix when logging Azure Application Insights custom dependencies. 20 | /// 21 | public const string Dependency = "Dependency"; 22 | 23 | /// 24 | /// Gets the log message prefix when logging Azure Application Insights Events. 25 | /// 26 | public const string Event = "Events"; 27 | 28 | /// 29 | /// Gets the log message prefix when logging Azure Application Insights Metrics. 30 | /// 31 | public const string Metric = "Metric"; 32 | 33 | /// 34 | /// Gets the log message prefix when logging Azure Application Insights Requests. 35 | /// 36 | public const string RequestViaHttp = "HTTP Request"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Core/TelemetryType.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace Arcus.Observability.Telemetry.Core 4 | { 5 | /// 6 | /// Represents the supported types of telemetry available to track during extensions on the . 7 | /// Also compatible (but not limited to) with Azure Application Insights (see: for more information). 8 | /// 9 | public enum TelemetryType 10 | { 11 | /// 12 | /// Specifies the type of logged telemetry as traces. 13 | /// 14 | Trace = 0, 15 | 16 | /// 17 | /// Specifies the type of logged telemetry as tracked dependencies. 18 | /// 19 | Dependency = 1, 20 | 21 | /// 22 | /// Specifies the type of logged telemetry as HTTP requests. 23 | /// 24 | Request = 2, 25 | 26 | /// 27 | /// Specifies the type of logged telemetry as custom events. 28 | /// 29 | Events = 4, 30 | 31 | /// 32 | /// Specifies the type of logged telemetry as metrics. 33 | /// 34 | Metrics = 8 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Enrichers/Arcus.Observability.Telemetry.Serilog.Enrichers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to improve telemetry with Serilog in applications 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Telemetry;Serilog 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Enrichers/Extensions/LogEventExtensions.cs: -------------------------------------------------------------------------------- 1 | using GuardNet; 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace Serilog.Events 5 | { 6 | /// 7 | /// Extensions on the model to work more easily with the type. 8 | /// 9 | public static class LogEventExtensions 10 | { 11 | /// 12 | /// Determines if the given contains a property with the specified and simple . 13 | /// 14 | /// The event on which the property should be present. 15 | /// The unique name of the property that should be present in the . 16 | /// The simple value of the property that should be present for the given . 17 | /// 18 | /// [true] if the specified contains the log property with the specified and the simple ; [false] otherwise. 19 | /// 20 | public static bool ContainsProperty(this LogEvent logEvent, string name, string value) 21 | { 22 | Guard.NotNull(logEvent, nameof(logEvent)); 23 | 24 | if (logEvent.Properties.TryGetValue(name, out LogEventPropertyValue actual)) 25 | { 26 | string actualValue = actual.ToString().Trim('\"'); 27 | return value == actualValue; 28 | } 29 | 30 | return false; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Filters/Arcus.Observability.Telemetry.Serilog.Filters.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to reduce telemetry with Serilog filters 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Telemetry;Serilog 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0;net6.0;netstandard2.1 5 | Arcus 6 | Arcus 7 | Provides capability to improve telemetry with Serilog that is sent to Azure Application Insights 8 | Copyright (c) Arcus 9 | https://observability.arcus-azure.net/ 10 | https://github.com/arcus-azure/arcus.observability 11 | LICENSE 12 | icon.png 13 | Git 14 | README.md 15 | Azure;Observability;Telemetry;Serilog 16 | true 17 | true 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Configuration/ApplicationInsightsSinkOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration 2 | { 3 | /// 4 | /// User-defined configuration options to influence the behavior of the Azure Application Insights Serilog sink. 5 | /// 6 | public class ApplicationInsightsSinkOptions 7 | { 8 | /// 9 | /// Gets the Application Insights options related to tracking requests. 10 | /// 11 | public ApplicationInsightsSinkRequestOptions Request { get; } = new ApplicationInsightsSinkRequestOptions(); 12 | 13 | /// 14 | /// Gets the Application Insights options related to tracking exceptions. 15 | /// 16 | public ApplicationInsightsSinkExceptionOptions Exception { get; } = new ApplicationInsightsSinkExceptionOptions(); 17 | 18 | /// 19 | /// Gets the Application Insights options related to telemetry correlation. 20 | /// 21 | public ApplicationInsightsSinkCorrelationOptions Correlation { get; } = new ApplicationInsightsSinkCorrelationOptions(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Configuration/ApplicationInsightsSinkRequestOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GuardNet; 3 | 4 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration 5 | { 6 | /// 7 | /// User-defined configuration options to influence the behavior of the Azure Application Insights Serilog sink while tracking requests. 8 | /// 9 | public class ApplicationInsightsSinkRequestOptions 10 | { 11 | private Func _generatedId = Guid.NewGuid().ToString; 12 | 13 | /// 14 | /// Gets or sets the function to generate the request ID of the telemetry model while tracking requests. 15 | /// Default: GUID generation. 16 | /// 17 | /// Thrown when the is null. 18 | public Func GenerateId 19 | { 20 | get => _generatedId; 21 | set 22 | { 23 | Guard.NotNull(value, nameof(value), "Requires a function to generate the request ID of the telemetry model while tracking requests"); 24 | _generatedId = value; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Configuration/ApplicationNameTelemetryInitializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Core; 3 | using GuardNet; 4 | using Microsoft.ApplicationInsights.Channel; 5 | using Microsoft.ApplicationInsights.Extensibility; 6 | 7 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration 8 | { 9 | /// 10 | /// Represents an that configures the application's name. 11 | /// 12 | public class ApplicationNameTelemetryInitializer : ITelemetryInitializer 13 | { 14 | private readonly IAppName _applicationName; 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// The instance to retrieve the application name. 20 | /// Thrown when the is null. 21 | public ApplicationNameTelemetryInitializer(IAppName applicationName) 22 | { 23 | Guard.NotNull(applicationName, nameof(applicationName), $"Requires an application name ({nameof(IAppName)}) implementation to retrieve the application name to initialize in the telemetry"); 24 | _applicationName = applicationName; 25 | } 26 | 27 | /// 28 | /// Initializes properties of the specified object. 29 | /// 30 | public void Initialize(ITelemetry telemetry) 31 | { 32 | if (telemetry?.Context?.Cloud != null) 33 | { 34 | string componentName = _applicationName.GetApplicationName(); 35 | telemetry.Context.Cloud.RoleName = componentName; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Configuration/ApplicationVersionTelemetryInitializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Core; 3 | using GuardNet; 4 | using Microsoft.ApplicationInsights.Channel; 5 | using Microsoft.ApplicationInsights.Extensibility; 6 | 7 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration 8 | { 9 | /// 10 | /// Represents an that configures the application's version. 11 | /// 12 | public class ApplicationVersionTelemetryInitializer : ITelemetryInitializer 13 | { 14 | private readonly IAppVersion _applicationVersion; 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// The instance to retrieve the application version. 20 | /// Thrown when the is null. 21 | public ApplicationVersionTelemetryInitializer(IAppVersion applicationVersion) 22 | { 23 | Guard.NotNull(applicationVersion, nameof(applicationVersion), $"Requires an application version ({nameof(IAppVersion)}) implementation to retrieve the application version to initialize in the telemetry"); 24 | _applicationVersion = applicationVersion; 25 | } 26 | 27 | /// 28 | /// Initializes properties of the specified object. 29 | /// 30 | public void Initialize(ITelemetry telemetry) 31 | { 32 | if (telemetry?.Context?.Component != null) 33 | { 34 | string version = _applicationVersion.GetVersion(); 35 | telemetry.Context.Component.Version = version; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Converters/CloudContextConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Core; 3 | using Microsoft.ApplicationInsights.Channel; 4 | using Microsoft.ApplicationInsights.DataContracts; 5 | using Microsoft.ApplicationInsights.Extensibility.Implementation; 6 | using Serilog.Events; 7 | 8 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Converters 9 | { 10 | /// 11 | /// Represents a conversion from the Cloud-related logging information to the Application Insights instance. 12 | /// 13 | public class CloudContextConverter 14 | { 15 | /// 16 | /// Enrich the given with the Cloud-related information found in the . 17 | /// 18 | /// The log event that may contains Cloud-related information. 19 | /// The telemetry instance to enrich. 20 | public void EnrichWithAppInfo(LogEvent logEvent, ITelemetry telemetry) 21 | { 22 | if (telemetry.Context?.Cloud == null) 23 | { 24 | return; 25 | } 26 | 27 | var componentName = logEvent.Properties.GetAsRawString(ContextProperties.General.ComponentName); 28 | var machineName = logEvent.Properties.GetAsRawString(ContextProperties.General.MachineName); 29 | var podName = logEvent.Properties.GetAsRawString(ContextProperties.Kubernetes.PodName); 30 | 31 | telemetry.Context.Cloud.RoleName = componentName; 32 | telemetry.Context.Cloud.RoleInstance = string.IsNullOrWhiteSpace(podName) ? machineName : podName; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/DependencyType.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ApplicationInsights.DataContracts; 2 | 3 | namespace Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights 4 | { 5 | /// 6 | /// The type of the instance. 7 | /// 8 | public enum DependencyType 9 | { 10 | /// 11 | /// Sets the as a HTTP dependency. 12 | /// 13 | Http, 14 | 15 | /// 16 | /// Sets the as a SQL dependency. 17 | /// 18 | Sql 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Extensions/IDictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using GuardNet; 2 | 3 | // ReSharper disable once CheckNamespace 4 | namespace System.Collections.Generic 5 | { 6 | /// 7 | /// Represents a set of extension on the to more easily interact with multiple dictionaries. 8 | /// 9 | // ReSharper disable once InconsistentNaming 10 | internal static class IDictionaryExtensions 11 | { 12 | /// 13 | /// Adds the items from the to this current . 14 | /// 15 | /// The current set of items. 16 | /// The additional set of items. 17 | /// Thrown when the or is null. 18 | internal static void AddRange(this IDictionary items, IDictionary additionalItems) 19 | { 20 | Guard.NotNull(items, nameof(items), "Requires a base dictionary to add the additional items to"); 21 | Guard.NotNull(additionalItems, nameof(additionalItems), "Requires an additional set of items to add to the base dictionary"); 22 | 23 | foreach (KeyValuePair property in additionalItems) 24 | { 25 | items.Add(property); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights/Extensions/ILoggingBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GuardNet; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Serilog.Extensions.Logging; 5 | 6 | // ReSharper disable once CheckNamespace 7 | namespace Microsoft.Extensions.Logging 8 | { 9 | /// 10 | /// Extensions on the 11 | /// 12 | // ReSharper disable once InconsistentNaming 13 | public static class ILoggingBuilderExtensions 14 | { 15 | /// 16 | /// Add Serilog to the logging pipeline. 17 | /// 18 | /// The to add logging provider to. 19 | /// The factory function to create an Serilog logger implementation. 20 | /// Thrown when the or is null. 21 | public static ILoggingBuilder AddSerilog( 22 | this ILoggingBuilder builder, 23 | Func implementationFactory) 24 | { 25 | Guard.NotNull(builder, nameof(builder), "Requires a logging builder instance to add the Serilog logger provider"); 26 | Guard.NotNull(implementationFactory, nameof(implementationFactory), "Requires an implementation factory to build up the Serilog logger"); 27 | 28 | builder.Services.AddSingleton(provider => 29 | { 30 | return new SerilogLoggerProvider(implementationFactory(provider), dispose: true); 31 | }); 32 | 33 | return builder; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Core/Arcus.Observability.Tests.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Core/InMemoryLogSink.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using System.Collections.Generic; 3 | using Serilog.Core; 4 | using Serilog.Events; 5 | 6 | namespace Arcus.Observability.Tests.Core 7 | { 8 | /// 9 | /// Represents a logging sink that collects the emitted log events in-memory. 10 | /// 11 | public class InMemoryLogSink : ILogEventSink 12 | { 13 | private readonly ConcurrentQueue _logEmits = new ConcurrentQueue(); 14 | 15 | /// 16 | /// Gets the current log emits available on the sink. 17 | /// 18 | public IEnumerable CurrentLogEmits => _logEmits.ToArray(); 19 | 20 | /// 21 | /// Emit the provided log event to the sink. 22 | /// 23 | /// The log event to write. 24 | public void Emit(LogEvent logEvent) 25 | { 26 | _logEmits.Enqueue(logEvent); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Core/TemporaryEnvironmentVariable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GuardNet; 3 | 4 | namespace Arcus.Observability.Tests.Core 5 | { 6 | /// 7 | /// Represents a temporary environment variable that gets removed when the model gets disposed. 8 | /// 9 | public class TemporaryEnvironmentVariable : IDisposable 10 | { 11 | private readonly string _name; 12 | 13 | private TemporaryEnvironmentVariable(string name) 14 | { 15 | Guard.NotNullOrWhitespace(name, nameof(name)); 16 | 17 | _name = name; 18 | } 19 | 20 | /// 21 | /// Creates a instance that creates and removes the environment variable 22 | /// with and during its lifetime. 23 | /// 24 | /// The name of the environment variable. 25 | /// The value of the environment variable. 26 | public static TemporaryEnvironmentVariable Create(string name, string value) 27 | { 28 | Guard.NotNullOrWhitespace(name, nameof(name)); 29 | Guard.NotNullOrWhitespace(value, nameof(value)); 30 | 31 | Environment.SetEnvironmentVariable(name, value, EnvironmentVariableTarget.Process); 32 | return new TemporaryEnvironmentVariable(name); 33 | } 34 | 35 | 36 | /// 37 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 38 | /// 39 | public void Dispose() 40 | { 41 | Environment.SetEnvironmentVariable(_name, value: null, target: EnvironmentVariableTarget.Process); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Arcus.Observability.Tests.Integration.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Always 37 | 38 | 39 | Always 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/AssertX.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using GuardNet; 6 | using Xunit.Sdk; 7 | 8 | // ReSharper disable once CheckNamespace 9 | namespace Xunit 10 | { 11 | /// 12 | /// Extension class on the xUnit . 13 | /// 14 | [DebuggerStepThrough] 15 | public static class AssertX 16 | { 17 | /// 18 | /// Verifies that a has at least one element that matches the given . 19 | /// 20 | /// The type of the elements in the . 21 | /// The collection to set through. 22 | /// The element assertion to find at least a single element that matches. 23 | /// Thrown when the or is null. 24 | public static void Any(IEnumerable collection, Action assertion) 25 | { 26 | Guard.NotNull(collection, nameof(collection), "Requires collection of elements to find a single element that matches the assertion"); 27 | Guard.NotNull(assertion, nameof(assertion), "Requires an element assertion to verify if an single element in the collection matches"); 28 | 29 | Assert.NotEmpty(collection); 30 | 31 | T[] array = collection.ToArray(); 32 | var stack = new Stack>(); 33 | 34 | for (var index = 0; index < array.Length; index++) 35 | { 36 | T item = array[index]; 37 | try 38 | { 39 | assertion(item); 40 | return; 41 | } 42 | catch (Exception exception) 43 | { 44 | stack.Push(new Tuple(index, item, exception)); 45 | } 46 | } 47 | 48 | if (stack.Count > 0) 49 | { 50 | throw new ContainsException(array.Length, stack.ToArray()); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Configuration/ServicePrincipal.cs: -------------------------------------------------------------------------------- 1 | using Arcus.Testing; 2 | using GuardNet; 3 | 4 | namespace Arcus.Observability.Tests.Integration.Configuration 5 | { 6 | /// 7 | /// Represents the service principal to authenticate against Azure services. 8 | /// 9 | public class ServicePrincipal 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | public ServicePrincipal(string tenantId, string clientId, string clientSecret) 15 | { 16 | Guard.NotNullOrWhitespace(tenantId, nameof(tenantId)); 17 | Guard.NotNullOrWhitespace(clientId, nameof(clientId)); 18 | Guard.NotNullOrWhitespace(clientSecret, nameof(clientSecret)); 19 | 20 | TenantId = tenantId; 21 | ClientId = clientId; 22 | ClientSecret = clientSecret; 23 | } 24 | 25 | /// 26 | /// Gets the tenant ID of the Azure Active Directory tenant. 27 | /// 28 | public string TenantId { get; } 29 | 30 | /// 31 | /// Gets the client ID of the service principal. 32 | /// 33 | public string ClientId { get; } 34 | 35 | /// 36 | /// Gets the client secret of the service principal. 37 | /// 38 | public string ClientSecret { get; } 39 | } 40 | 41 | /// 42 | /// Extensions on the to load the service principal from the test configuration. 43 | /// 44 | public static class TestConfigExtensions 45 | { 46 | /// 47 | /// Loads the service principal from the test configuration. 48 | /// 49 | public static ServicePrincipal GetServicePrincipal(this TestConfig config) 50 | { 51 | return new ServicePrincipal( 52 | config["Arcus:TenantId"], 53 | config["Arcus:ServicePrincipal:ClientId"], 54 | config["Arcus:ServicePrincipal:ClientSecret"]); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Fixture/TestException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Arcus.Observability.Tests.Integration.Fixture 4 | { 5 | /// 6 | /// Represents a custom to determine if the exception is tracked as expected. 7 | /// 8 | public class TestException : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public TestException() 14 | { 15 | } 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The message that describes the exception. 21 | public TestException(string message) : base(message) 22 | { 23 | } 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | /// The message that describes the exception. 29 | /// The exception that is the cause of the current exception. 30 | public TestException(string message, Exception innerException) : base(message, innerException) 31 | { 32 | } 33 | 34 | /// 35 | /// Gets the custom test property of this exception to determine if the property is considered while tracking the exception. 36 | /// 37 | public string SpyProperty { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/IntegrationTest.cs: -------------------------------------------------------------------------------- 1 | using Arcus.Testing; 2 | using Xunit.Abstractions; 3 | 4 | namespace Arcus.Observability.Tests.Integration 5 | { 6 | public class IntegrationTest 7 | { 8 | protected TestConfig Configuration { get; } 9 | 10 | public IntegrationTest(ITestOutputHelper testOutput) 11 | { 12 | Configuration = TestConfig.Create(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/AzureKeyVaultDependencyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.ApplicationInsights.Query.Models; 5 | using Microsoft.Extensions.Logging; 6 | using Xunit; 7 | using Xunit.Abstractions; 8 | 9 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights 10 | { 11 | public class AzureKeyVaultDependencyTests : ApplicationInsightsSinkTests 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public AzureKeyVaultDependencyTests(ITestOutputHelper outputWriter) : base(outputWriter) 17 | { 18 | } 19 | 20 | [Fact] 21 | public async Task LogAzureKeyVaultDependency_SinksToApplicationInsights_ResultsInAzureKeyVaultDependencyTelemetry() 22 | { 23 | // Arrange 24 | string dependencyType = "Azure key vault"; 25 | string vaultUri = "https://myvault.vault.azure.net"; 26 | string secretName = "MySecret"; 27 | string dependencyName = vaultUri; 28 | string dependencyId = Guid.NewGuid().ToString(); 29 | 30 | bool isSuccessful = BogusGenerator.PickRandom(true, false); 31 | DateTimeOffset startTime = DateTimeOffset.Now; 32 | TimeSpan duration = BogusGenerator.Date.Timespan(); 33 | Dictionary telemetryContext = CreateTestTelemetryContext(); 34 | 35 | Logger.LogAzureKeyVaultDependency(vaultUri, secretName, isSuccessful, startTime, duration, dependencyId, telemetryContext); 36 | 37 | // Assert 38 | await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client => 39 | { 40 | EventsDependencyResult[] results = await client.GetDependenciesAsync(); 41 | AssertX.Any(results, result => 42 | { 43 | Assert.Equal(dependencyType, result.Dependency.Type); 44 | Assert.Equal(dependencyId, result.Dependency.Id); 45 | Assert.Equal(vaultUri, result.Dependency.Target); 46 | Assert.Equal(secretName, result.Dependency.Data); 47 | Assert.Equal(dependencyName, result.Dependency.Name); 48 | }); 49 | }); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/AzureSearchDependencyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.ApplicationInsights.Query.Models; 5 | using Microsoft.Extensions.Logging; 6 | using Xunit; 7 | using Xunit.Abstractions; 8 | 9 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights 10 | { 11 | public class AzureSearchDependencyTests : ApplicationInsightsSinkTests 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public AzureSearchDependencyTests(ITestOutputHelper outputWriter) : base(outputWriter) 17 | { 18 | } 19 | 20 | [Fact] 21 | public async Task LogAzureSearchDependency_SinksToApplicationInsights_ResultsInAzureSearchDependencyTelemetry() 22 | { 23 | // Arrange 24 | string dependencyType = "Azure Search"; 25 | string searchServiceName = BogusGenerator.Commerce.Product(); 26 | string operationName = BogusGenerator.Commerce.ProductName(); 27 | string dependencyName = searchServiceName; 28 | string dependencyId = BogusGenerator.Lorem.Word(); 29 | 30 | bool isSuccessful = BogusGenerator.PickRandom(true, false); 31 | DateTimeOffset startTime = DateTimeOffset.Now; 32 | TimeSpan duration = BogusGenerator.Date.Timespan(); 33 | Dictionary telemetryContext = CreateTestTelemetryContext(); 34 | 35 | // Act 36 | Logger.LogAzureSearchDependency(searchServiceName, operationName, isSuccessful, startTime, duration, dependencyId, telemetryContext); 37 | 38 | // Assert 39 | await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client => 40 | { 41 | EventsDependencyResult[] results = await client.GetDependenciesAsync(); 42 | AssertX.Any(results, result => 43 | { 44 | Assert.Equal(dependencyType, result.Dependency.Type); 45 | Assert.Equal(dependencyId, result.Dependency.Id); 46 | Assert.Equal(searchServiceName, result.Dependency.Target); 47 | Assert.Equal(operationName, result.Dependency.Data); 48 | Assert.Equal(dependencyName, result.Dependency.Name); 49 | }); 50 | }); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/CustomRequestTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.ApplicationInsights.Query.Models; 5 | using Microsoft.Extensions.Logging; 6 | using Serilog; 7 | using Xunit; 8 | using Xunit.Abstractions; 9 | 10 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights 11 | { 12 | public class CustomRequestTests : ApplicationInsightsSinkTests 13 | { 14 | public CustomRequestTests(ITestOutputHelper outputWriter) : base(outputWriter) 15 | { 16 | } 17 | 18 | [Fact] 19 | public async Task LogCustomRequest_SinksToApplicationInsights_ResultsInCustomRequestTelemetry() 20 | { 21 | // Arrange 22 | string componentName = BogusGenerator.Commerce.ProductName(); 23 | LoggerConfiguration.Enrich.WithComponentName(componentName); 24 | 25 | string customRequestSource = BogusGenerator.Lorem.Word(); 26 | string operationName = BogusGenerator.Lorem.Word(); 27 | 28 | bool isSuccessful = BogusGenerator.Random.Bool(); 29 | TimeSpan duration = BogusGenerator.Date.Timespan(); 30 | DateTimeOffset startTime = DateTimeOffset.Now; 31 | Dictionary telemetryContext = CreateTestTelemetryContext(); 32 | 33 | // Act 34 | Logger.LogCustomRequest(customRequestSource, operationName, isSuccessful, startTime, duration, telemetryContext); 35 | 36 | // Assert 37 | await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client => 38 | { 39 | EventsRequestResult[] requests = await client.GetRequestsAsync(); 40 | AssertX.Any(requests, result => 41 | { 42 | Assert.Equal(operationName, result.Request.Name); 43 | Assert.Contains(customRequestSource, result.Request.Source); 44 | Assert.True(string.IsNullOrWhiteSpace(result.Request.Url), "request URL should be blank"); 45 | Assert.Equal(operationName, result.Operation.Name); 46 | Assert.Equal(isSuccessful, result.Success); 47 | Assert.Equal(componentName, result.Cloud.RoleName); 48 | }); 49 | }); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/EventHubsDependencyTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.ApplicationInsights.Query.Models; 5 | using Microsoft.Extensions.Logging; 6 | using Serilog; 7 | using Xunit; 8 | using Xunit.Abstractions; 9 | 10 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights 11 | { 12 | public class EventHubsDependencyTests : ApplicationInsightsSinkTests 13 | { 14 | public EventHubsDependencyTests(ITestOutputHelper outputWriter) : base(outputWriter) 15 | { 16 | } 17 | 18 | [Fact] 19 | public async Task LogEventHubsDependency_SinksToApplicationInsights_ResultsInEventHubsDependencyTelemetry() 20 | { 21 | // Arrange 22 | string componentName = BogusGenerator.Commerce.ProductName(); 23 | LoggerConfiguration.Enrich.WithComponentName(componentName); 24 | 25 | string dependencyType = "Azure Event Hubs"; 26 | string eventHubName = BogusGenerator.Commerce.ProductName(); 27 | string namespaceName = BogusGenerator.Finance.AccountName(); 28 | string dependencyName = eventHubName; 29 | string dependencyId = "test-parent"; 30 | 31 | bool isSuccessful = BogusGenerator.PickRandom(true, false); 32 | DateTimeOffset startTime = DateTimeOffset.Now; 33 | TimeSpan duration = BogusGenerator.Date.Timespan(); 34 | Dictionary telemetryContext = CreateTestTelemetryContext(); 35 | 36 | // Act 37 | Logger.LogEventHubsDependency(namespaceName, eventHubName, isSuccessful, startTime, duration, dependencyId, telemetryContext); 38 | 39 | // Assert 40 | await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client => 41 | { 42 | EventsDependencyResult[] results = await client.GetDependenciesAsync(); 43 | AssertX.Any(results, result => 44 | { 45 | Assert.Equal(dependencyType, result.Dependency.Type); 46 | Assert.Equal(eventHubName, result.Dependency.Target); 47 | Assert.Equal(namespaceName, result.Dependency.Data); 48 | Assert.Equal(componentName, result.Cloud.RoleName); 49 | Assert.Equal(dependencyName, result.Dependency.Name); 50 | Assert.Equal(dependencyId, result.Dependency.Id); 51 | }); 52 | }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/Fixture/InMemoryApplicationInsightsTelemetryConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration; 6 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Converters; 7 | using Microsoft.ApplicationInsights.Channel; 8 | using Microsoft.ApplicationInsights.DataContracts; 9 | using Serilog.Events; 10 | using Serilog.Sinks.ApplicationInsights.TelemetryConverters; 11 | 12 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights.Fixture 13 | { 14 | public class InMemoryApplicationInsightsTelemetryConverter : TelemetryConverterBase 15 | { 16 | private readonly ConcurrentStack _telemetries = new(); 17 | 18 | public ApplicationInsightsSinkOptions Options { get; set; } 19 | 20 | public RequestTelemetry[] Requests => _telemetries.ToArray().OfType().ToArray(); 21 | public DependencyTelemetry[] Dependencies => _telemetries.ToArray().OfType().ToArray(); 22 | public EventTelemetry[] Events => _telemetries.ToArray().OfType().ToArray(); 23 | public MetricTelemetry[] Metrics => _telemetries.ToArray().OfType().ToArray(); 24 | public TraceTelemetry[] Traces => _telemetries.ToArray().OfType().ToArray(); 25 | public ExceptionTelemetry[] Exceptions => _telemetries.ToArray().OfType().ToArray(); 26 | 27 | public override IEnumerable Convert(LogEvent logEvent, IFormatProvider formatProvider) 28 | { 29 | var converter = ApplicationInsightsTelemetryConverter.Create(Options); 30 | 31 | IEnumerable telemetries = converter.Convert(logEvent, formatProvider); 32 | foreach (ITelemetry telemetry in telemetries) 33 | { 34 | _telemetries.Push(telemetry); 35 | } 36 | 37 | return Enumerable.Empty(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/Sinks/ApplicationInsights/MetricTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.Azure.ApplicationInsights.Query.Models; 4 | using Microsoft.Extensions.Logging; 5 | using Xunit; 6 | using Xunit.Abstractions; 7 | 8 | namespace Arcus.Observability.Tests.Integration.Serilog.Sinks.ApplicationInsights 9 | { 10 | public class MetricTests : ApplicationInsightsSinkTests 11 | { 12 | public MetricTests(ITestOutputHelper outputWriter) : base(outputWriter) 13 | { 14 | } 15 | 16 | [Fact] 17 | public async Task LogCustomMetric_SinksToApplicationInsights_ResultsInMetricTelemetry() 18 | { 19 | // Arrange 20 | string metricName = "threshold"; 21 | double metricValue = 0.25; 22 | Dictionary telemetryContext = CreateTestTelemetryContext(); 23 | 24 | // Act 25 | Logger.LogCustomMetric(metricName, metricValue, telemetryContext); 26 | 27 | // Assert 28 | await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client => 29 | { 30 | EventsMetricsResult[] results = await client.GetMetricsAsync(metricName); 31 | AssertX.Any(results, metric => 32 | { 33 | Assert.Equal(metricName, metric.Name); 34 | Assert.Equal(metricValue, metric.Value); 35 | 36 | ContainsTelemetryContext(telemetryContext, metric); 37 | }); 38 | }); 39 | } 40 | 41 | private static void ContainsTelemetryContext(Dictionary telemetryContext, EventsMetricsResult metric) 42 | { 43 | Assert.All(telemetryContext, item => 44 | { 45 | string actual = Assert.Contains(item.Key, metric.CustomDimensions); 46 | Assert.Equal(item.Value.ToString(), actual); 47 | }); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/Serilog/XunitLogEventSink.cs: -------------------------------------------------------------------------------- 1 | using GuardNet; 2 | using Serilog.Core; 3 | using Serilog.Events; 4 | using Xunit.Abstractions; 5 | 6 | namespace Arcus.Observability.Tests.Integration.Serilog 7 | { 8 | /// 9 | /// representation of an instance. 10 | /// 11 | public class XunitLogEventSink : ILogEventSink 12 | { 13 | private readonly ITestOutputHelper _outputWriter; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public XunitLogEventSink(ITestOutputHelper outputWriter) 19 | { 20 | Guard.NotNull(outputWriter, nameof(outputWriter)); 21 | _outputWriter = outputWriter; 22 | } 23 | 24 | /// 25 | /// Emit the provided log event to the sink. 26 | /// 27 | /// The log event to write. 28 | public void Emit(LogEvent logEvent) 29 | { 30 | _outputWriter.WriteLine(logEvent.RenderMessage()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Integration/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Arcus": { 3 | "TenantId": "#{Arcus.Observability.TenantId}#", 4 | "ServicePrincipal": { 5 | "ClientId": "#{Arcus.Observability.ServicePrincipal.ClientId}#", 6 | "ClientSecret": "#{Arcus.Observability.ServicePrincipal.ClientSecret}#" 7 | }, 8 | "ApplicationInsights": { 9 | "InstrumentationKey": "#{Arcus.Observability.ApplicationInsights.InstrumentationKey}#", 10 | "LogAnalytics": { 11 | "WorkspaceId": "#{Arcus.Observability.ApplicationInsights.LogAnalytics.WorkspaceId}#" 12 | } 13 | } 14 | }, 15 | "AzureFunctions": { 16 | "HttpPort": "#{AzureFunctions.HttpPort}#" 17 | } 18 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Arcus.Observability.Tests.Unit.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | CS0618 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Blanks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Arcus.Observability.Tests.Unit 7 | { 8 | /// 9 | /// Represents a test data class with only blank values. 10 | /// 11 | public class Blanks : IEnumerable 12 | { 13 | /// 14 | /// Returns an enumerator that iterates through the collection. 15 | /// 16 | /// An enumerator that can be used to iterate through the collection. 17 | public IEnumerator GetEnumerator() 18 | { 19 | yield return new object[] { null }; 20 | yield return new object[] { String.Empty }; 21 | yield return new object[] { " " }; 22 | yield return new object[] { " " }; 23 | } 24 | 25 | /// 26 | /// Returns an enumerator that iterates through a collection. 27 | /// 28 | /// An object that can be used to iterate through the collection. 29 | IEnumerator IEnumerable.GetEnumerator() 30 | { 31 | return GetEnumerator(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Correlation/CorrelationInfoTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Correlation; 3 | using Xunit; 4 | 5 | namespace Arcus.Observability.Tests.Unit.Correlation 6 | { 7 | [Trait("Category", "Unit")] 8 | public class CorrelationInfoTests 9 | { 10 | [Fact] 11 | public void Constructor_Valid_Succeeds() 12 | { 13 | // Arrange 14 | var transactionId = Guid.NewGuid().ToString(); 15 | var operationId = Guid.NewGuid().ToString(); 16 | 17 | // Act 18 | var messageCorrelationInfo = new CorrelationInfo(operationId, transactionId); 19 | 20 | // Assert 21 | Assert.Equal(operationId, messageCorrelationInfo.OperationId); 22 | Assert.Equal(transactionId, messageCorrelationInfo.TransactionId); 23 | } 24 | 25 | [Fact] 26 | public void Constructor_NoTransactionIdSpecified_Succeeds() 27 | { 28 | // Arrange 29 | var operationId = Guid.NewGuid().ToString(); 30 | 31 | // Act 32 | var messageCorrelationInfo = new CorrelationInfo(operationId, transactionId: null); 33 | 34 | // Assert 35 | Assert.Equal(operationId, messageCorrelationInfo.OperationId); 36 | Assert.Null(messageCorrelationInfo.TransactionId); 37 | } 38 | 39 | [Fact] 40 | public void Constructor_NoOperationIdSpecified_ThrowsException() 41 | { 42 | // Arrange 43 | var transactionId = Guid.NewGuid().ToString(); 44 | 45 | // Act & Assert 46 | Assert.Throws(() => new CorrelationInfo(operationId: null, transactionId: transactionId)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Correlation/TestCorrelationInfo.cs: -------------------------------------------------------------------------------- 1 | using Arcus.Observability.Correlation; 2 | 3 | namespace Arcus.Observability.Tests.Unit.Correlation 4 | { 5 | /// 6 | /// Test model to extend the . 7 | /// 8 | public class TestCorrelationInfo : CorrelationInfo 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public TestCorrelationInfo(string operationId, string transactionId, string testId) 14 | : base(operationId, transactionId) 15 | { 16 | TestId = testId; 17 | } 18 | 19 | /// 20 | /// Gets the test identifier for this correlation information model. 21 | /// 22 | public string TestId { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Correlation/TestCorrelationInfoAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Correlation; 3 | 4 | namespace Arcus.Observability.Tests.Unit.Correlation 5 | { 6 | /// 7 | /// Test implementation to access the model 8 | /// 9 | public class TestCorrelationInfoAccessor : ICorrelationInfoAccessor 10 | { 11 | private TestCorrelationInfo _correlationInfo; 12 | 13 | /// 14 | /// Gets the current correlation information initialized in this context. 15 | /// 16 | public TestCorrelationInfo GetCorrelationInfo() 17 | { 18 | return _correlationInfo; 19 | } 20 | 21 | /// 22 | /// Sets the current correlation information for this context. 23 | /// 24 | /// The correlation model to set. 25 | public void SetCorrelationInfo(TestCorrelationInfo correlationInfo) 26 | { 27 | _correlationInfo = correlationInfo; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Fixture/Order.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Arcus.Observability.Tests.Unit.Fixture 5 | { 6 | public class Order 7 | { 8 | [JsonPropertyName("id")] 9 | public string Id { get; set; } 10 | 11 | [JsonPropertyName("orderNumber")] 12 | public int OrderNumber { get; set; } 13 | 14 | [JsonPropertyName("scheduled")] 15 | public DateTimeOffset Scheduled { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Fixture/OrderGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Bogus; 5 | using Moq; 6 | 7 | namespace Arcus.Observability.Tests.Unit.Fixture 8 | { 9 | public static class OrderGenerator 10 | { 11 | public static Order Generate() 12 | { 13 | Order order = new Faker() 14 | .RuleFor(model => model.Id, bogus => bogus.Random.Guid().ToString()) 15 | .RuleFor(model => model.OrderNumber, bogus => bogus.Random.Int()) 16 | .RuleFor(model => model.Scheduled, bogus => bogus.Date.RecentOffset()) 17 | .Generate(); 18 | 19 | return order; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/AssemblyAppVersionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Core; 3 | using Xunit; 4 | 5 | namespace Arcus.Observability.Tests.Unit.Serilog 6 | { 7 | public class AssemblyAppVersionTests 8 | { 9 | [Fact] 10 | public void CreateAppVersion_WithoutConsumerType_Throws() 11 | { 12 | Assert.ThrowsAny(() => new AssemblyAppVersion(consumerType: null)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/CustomTelemetryConverterTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration; 3 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Converters; 4 | using Xunit; 5 | 6 | namespace Arcus.Observability.Tests.Unit.Serilog 7 | { 8 | [Trait("Category", "Unit")] 9 | public class CustomTelemetryConverterTests 10 | { 11 | [Fact] 12 | public void CreateTraceConverter_WithoutOptions_Fails() 13 | { 14 | Assert.ThrowsAny(() => new TraceTelemetryConverter(options: null)); 15 | } 16 | 17 | [Fact] 18 | public void CreateMetricConverter_WithoutOptions_Fails() 19 | { 20 | Assert.ThrowsAny(() => new MetricTelemetryConverter(options: null)); 21 | } 22 | 23 | [Fact] 24 | public void CreateDependencyConverter_WithoutOptions_Fails() 25 | { 26 | Assert.ThrowsAny(() => new DependencyTelemetryConverter(options: null)); 27 | } 28 | 29 | [Fact] 30 | public void CreateEventConverter_WithoutOptions_Fails() 31 | { 32 | Assert.ThrowsAny(() => new EventTelemetryConverter(options: null)); 33 | } 34 | 35 | [Fact] 36 | public void CreateRequestConverter_WithoutOptions_Fails() 37 | { 38 | Assert.ThrowsAny(() => new RequestTelemetryConverter(options: (ApplicationInsightsSinkOptions) null)); 39 | } 40 | 41 | [Fact] 42 | public void CreateExceptionConverter_WithoutOptions_Fails() 43 | { 44 | Assert.ThrowsAny(() => new ExceptionTelemetryConverter(options: (ApplicationInsightsSinkOptions) null)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/Enrichers/TestCorrelationInfoEnricher.cs: -------------------------------------------------------------------------------- 1 | using Arcus.Observability.Correlation; 2 | using Arcus.Observability.Telemetry.Serilog.Enrichers; 3 | using Arcus.Observability.Tests.Unit.Correlation; 4 | using Serilog.Core; 5 | using Serilog.Events; 6 | 7 | namespace Arcus.Observability.Tests.Unit.Serilog.Enrichers 8 | { 9 | /// 10 | /// Test implementation for the using the test model. 11 | /// 12 | public class TestCorrelationInfoEnricher : CorrelationInfoEnricher 13 | { 14 | public const string TestId = "TestId"; 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// The accessor implementation for the custom model. 20 | public TestCorrelationInfoEnricher(ICorrelationInfoAccessor correlationInfoAccessor) : 21 | base(correlationInfoAccessor) 22 | { 23 | } 24 | 25 | /// 26 | /// Enrich the with the given model. 27 | /// 28 | /// The log event to enrich with correlation information. 29 | /// The log property factory to create log properties with correlation information. 30 | /// The correlation model that contains the current correlation information. 31 | protected override void EnrichCorrelationInfo( 32 | LogEvent logEvent, 33 | ILogEventPropertyFactory propertyFactory, 34 | TestCorrelationInfo correlationInfo) 35 | { 36 | LogEventProperty property = propertyFactory.CreateProperty(TestId, correlationInfo.TestId); 37 | logEvent.AddPropertyIfAbsent(property); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/ILoggingBuilderExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Correlation; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Logging; 5 | using Serilog; 6 | using Serilog.Extensions.Logging; 7 | using Xunit; 8 | 9 | namespace Arcus.Observability.Tests.Unit.Serilog 10 | { 11 | // ReSharper disable once InconsistentNaming 12 | public class ILoggingBuilderExtensionsTests 13 | { 14 | [Fact] 15 | public void AddSerilog_WithImplementationFactory_IncludesSerilogLogger() 16 | { 17 | // Arrange 18 | var services = new ServiceCollection(); 19 | services.AddCorrelation(); 20 | 21 | // Act 22 | services.AddLogging(builder => builder.AddSerilog(provider => 23 | { 24 | var accessor = provider.GetRequiredService(); 25 | return new LoggerConfiguration() 26 | .Enrich.WithCorrelationInfo(accessor) 27 | .WriteTo.Console() 28 | .CreateLogger(); 29 | })); 30 | 31 | // Assert 32 | IServiceProvider serviceProvider = services.BuildServiceProvider(); 33 | var loggerProvider = serviceProvider.GetService(); 34 | Assert.NotNull(loggerProvider); 35 | Assert.IsType(loggerProvider); 36 | Assert.NotNull(serviceProvider.GetService>()); 37 | } 38 | 39 | [Fact] 40 | public void AddSerilog_WithoutImplementationFactory_Fails() 41 | { 42 | // Arrange 43 | var services = new ServiceCollection(); 44 | 45 | // Act / Assert 46 | Assert.ThrowsAny( 47 | () => services.AddLogging(builder => builder.AddSerilog(implementationFactory: null))); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/IServiceCollectionExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Xunit; 4 | 5 | namespace Arcus.Observability.Tests.Unit.Serilog 6 | { 7 | public class IServiceCollectionExtensionsTests 8 | { 9 | [Fact] 10 | public void AddAssemblyAppVersion_WithoutConsumerType_Throws() 11 | { 12 | // Arrange 13 | var services = new ServiceCollection(); 14 | 15 | // Act / Assert 16 | Assert.ThrowsAny(() => services.AddAssemblyAppVersion(consumerType: null)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/LogEventPropertyValueExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Arcus.Observability.Telemetry.Core; 6 | using Arcus.Observability.Tests.Core; 7 | using Microsoft.Extensions.Logging; 8 | using Serilog; 9 | using Serilog.Context; 10 | using Serilog.Core; 11 | using Serilog.Events; 12 | using Serilog.Extensions.Logging; 13 | using Xunit; 14 | using ILogger = Microsoft.Extensions.Logging.ILogger; 15 | 16 | namespace Arcus.Observability.Tests.Unit.Serilog 17 | { 18 | public class LogEventPropertyValueExtensionsTests 19 | { 20 | [Fact] 21 | public void CanCorrectlyParseDateTimeWithTicksFromString() 22 | { 23 | var timestamp = DateTimeOffset.Now; 24 | string propertyKey = "timestamp"; 25 | 26 | var spySink = new InMemoryLogSink(); 27 | 28 | ILogger logger = CreateLogger( 29 | spySink, config => 30 | { 31 | config.Enrich.WithProperty(propertyKey, timestamp.ToString(FormatSpecifiers.InvariantTimestampFormat)); 32 | return config; 33 | }); 34 | 35 | logger.LogWarning("test"); 36 | 37 | var retrievedTimestamp = spySink.CurrentLogEmits.First().Properties.GetAsDateTimeOffset(propertyKey); 38 | 39 | Assert.Equal(timestamp, retrievedTimestamp); 40 | Assert.Equal(timestamp.Ticks, retrievedTimestamp.Ticks); 41 | } 42 | 43 | private static ILogger CreateLogger(ILogEventSink sink, Func configureLoggerConfiguration = null) 44 | { 45 | LoggerConfiguration config = new LoggerConfiguration().WriteTo.Sink(sink); 46 | config = configureLoggerConfiguration?.Invoke(config) ?? config; 47 | Logger logger = config.CreateLogger(); 48 | 49 | var factory = new SerilogLoggerFactory(logger); 50 | return factory.CreateLogger(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/Sinks/ApplicationInsights/ApplicationInsightsSinkExceptionOptionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration; 3 | using Xunit; 4 | 5 | namespace Arcus.Observability.Tests.Unit.Serilog.Sinks.ApplicationInsights 6 | { 7 | public class ApplicationInsightsSinkExceptionOptionsTests 8 | { 9 | [Theory] 10 | [ClassData(typeof(Blanks))] 11 | public void SetPropertyFormat_WithBlankValue_Fails(string propertyFormat) 12 | { 13 | // Arrange 14 | var options = new ApplicationInsightsSinkExceptionOptions(); 15 | 16 | // Act / Assert 17 | Assert.Throws(() => options.PropertyFormat = propertyFormat); 18 | } 19 | 20 | [Theory] 21 | [InlineData("Exception-{0}-{1}")] 22 | [InlineData("Exception.{0}.Inner.{0}")] 23 | [InlineData("Exception-")] 24 | public void SetPropertyFormat_WithInvalidStringFormat_Fails(string propertyFormat) 25 | { 26 | // Arrange 27 | var options = new ApplicationInsightsSinkExceptionOptions(); 28 | 29 | // Act / Assert 30 | Assert.Throws(() => options.PropertyFormat = propertyFormat); 31 | } 32 | 33 | [Theory] 34 | [InlineData("Exception.{0}")] 35 | [InlineData("{0} of exception")] 36 | [InlineData("Property '{0}' of exception")] 37 | public void SetPropertyFormat_WithCorrectStringFormat_Succeeds(string propertyFormat) 38 | { 39 | // Arrange 40 | var options = new ApplicationInsightsSinkExceptionOptions(); 41 | 42 | // Act / Assert 43 | options.PropertyFormat = propertyFormat; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Serilog/Sinks/ApplicationInsights/ApplicationInsightsSinkRequestOptionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Serilog.Sinks.ApplicationInsights.Configuration; 3 | using Xunit; 4 | 5 | namespace Arcus.Observability.Tests.Unit.Serilog.Sinks.ApplicationInsights 6 | { 7 | public class ApplicationInsightsSinkRequestOptionsTests 8 | { 9 | [Fact] 10 | public void DefaultGenerateId_WithNoCustomFunction_Succeeds() 11 | { 12 | // Arrange 13 | var options = new ApplicationInsightsSinkRequestOptions(); 14 | 15 | // Act 16 | string id = options.GenerateId(); 17 | 18 | // Assert 19 | Assert.False(string.IsNullOrWhiteSpace(id)); 20 | } 21 | 22 | [Fact] 23 | public void SetGenerateId_WithCustomFunction_Succeeds() 24 | { 25 | // Arrange 26 | var options = new ApplicationInsightsSinkRequestOptions(); 27 | var id = Guid.NewGuid().ToString(); 28 | 29 | // Act 30 | options.GenerateId = () => id; 31 | 32 | // Assert 33 | Assert.Equal(id, options.GenerateId()); 34 | } 35 | 36 | [Fact] 37 | public void SetGenerateId_WithoutFunction_Fails() 38 | { 39 | // Arrange 40 | var options = new ApplicationInsightsSinkRequestOptions(); 41 | 42 | // Act / Assert 43 | Assert.ThrowsAny(() => options.GenerateId = null); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Telemetry/DummyAppVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Arcus.Observability.Telemetry.Core; 3 | 4 | namespace Arcus.Observability.Tests.Unit.Telemetry 5 | { 6 | /// 7 | /// Dummy implementation. 8 | /// 9 | public class DummyAppVersion : IAppVersion 10 | { 11 | /// 12 | /// Gets the current version of the application. 13 | /// 14 | public string GetVersion() 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Telemetry/Logging/EventLoggingTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Arcus.Observability.Telemetry.Core; 4 | using Bogus; 5 | using Microsoft.Extensions.Logging; 6 | using Xunit; 7 | 8 | namespace Arcus.Observability.Tests.Unit.Telemetry.Logging 9 | { 10 | [Trait("Category", "Unit")] 11 | public class EventLoggingTests 12 | { 13 | private readonly Faker _bogusGenerator = new Faker(); 14 | 15 | [Fact] 16 | public void LogCustomEvent_ValidArguments_Succeeds() 17 | { 18 | // Arrange 19 | var logger = new TestLogger(); 20 | string eventName = _bogusGenerator.Name.FullName(); 21 | 22 | // Act 23 | logger.LogCustomEvent(eventName); 24 | 25 | // Assert 26 | var logMessage = logger.WrittenMessage; 27 | Assert.Contains(TelemetryType.Events.ToString(), logMessage); 28 | Assert.Contains(eventName, logMessage); 29 | } 30 | 31 | [Fact] 32 | public void LogCustomEvent_NoEventNameSpecified_ThrowsException() 33 | { 34 | // Arrange 35 | var logger = new TestLogger(); 36 | string eventName = null; 37 | 38 | // Act & Arrange 39 | Assert.Throws(() => logger.LogCustomEvent(eventName)); 40 | } 41 | 42 | [Fact] 43 | public void LogCustomEvent_WithContext_DoesNotAlterContext() 44 | { 45 | // Arrange 46 | var logger = new TestLogger(); 47 | string eventName = _bogusGenerator.Lorem.Word(); 48 | var context = new Dictionary(); 49 | 50 | // Act 51 | logger.LogCustomEvent(eventName, context); 52 | 53 | // Assert 54 | Assert.Empty(context); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Telemetry/StubAppVersion.cs: -------------------------------------------------------------------------------- 1 | using Arcus.Observability.Telemetry.Core; 2 | 3 | namespace Arcus.Observability.Tests.Unit.Telemetry 4 | { 5 | /// 6 | /// Stubbed implementation of the . 7 | /// 8 | public class StubAppVersion : IAppVersion 9 | { 10 | private readonly string _version; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The current stubbed application version. 16 | public StubAppVersion(string version) 17 | { 18 | _version = version; 19 | } 20 | 21 | /// 22 | /// Gets the current version of the application. 23 | /// 24 | public string GetVersion() 25 | { 26 | return _version; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/Telemetry/TimeSpanGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Bogus; 3 | 4 | namespace Arcus.Observability.Tests.Unit.Telemetry 5 | { 6 | public static class TimeSpanGenerator 7 | { 8 | private static readonly Faker _bogusGenerator = new Faker(); 9 | 10 | public static TimeSpan GeneratePositiveDuration() 11 | { 12 | TimeSpan duration = _bogusGenerator.Date.Timespan(); 13 | if (duration < TimeSpan.Zero) 14 | { 15 | return duration.Negate(); 16 | } 17 | 18 | return duration; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Arcus.Observability.Tests.Unit/TestLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace Arcus.Observability.Tests.Unit 5 | { 6 | public class TestLogger : ILogger 7 | { 8 | /// 9 | /// Last log message that was written 10 | /// 11 | public string WrittenMessage { get; private set; } 12 | 13 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, 14 | Func formatter) 15 | { 16 | WrittenMessage = state.ToString(); 17 | } 18 | 19 | public bool IsEnabled(LogLevel logLevel) 20 | { 21 | return true; 22 | } 23 | 24 | public IDisposable BeginScope(TState state) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } --------------------------------------------------------------------------------