Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure storage integration #1247

Merged
merged 33 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6d6aba3
Instrument send
russcam Mar 10, 2021
3667cc5
Move ConnectionString parsing into environment class
russcam Mar 10, 2021
60b340d
Source azure credentials from file or environment variables
russcam Mar 11, 2021
3e74b48
Integration tests and IgnoreMessageQueues configuration value
russcam Mar 15, 2021
7c627e0
Microsoft.Azure.ServiceBus integration
russcam Mar 15, 2021
09e4382
Rename to Elastic.Apm.Azure.ServiceBus
russcam Mar 16, 2021
61b9848
Use PropertyFetcher to get properties
russcam Mar 16, 2021
34edd2f
Add packaging information
russcam Mar 16, 2021
06feaf8
test with minimally supported versions
russcam Mar 16, 2021
bf4b7de
Add documentation
russcam Mar 16, 2021
5f1d28f
add example credential file
russcam Mar 16, 2021
1626540
Use DiagnosticListenerBase
russcam Mar 16, 2021
aa66bd8
Create and reuse same Service instance for message transactions
russcam Mar 17, 2021
bb29131
Run terraform locally with authenticated az account
russcam Mar 17, 2021
d9981b9
delete example credentials file
russcam Mar 17, 2021
f003524
add table terminator
russcam Mar 18, 2021
af7d1a2
Load credentials in CI from .credentials.json
russcam Mar 24, 2021
1fb40df
Add Azure Service Bus sample application
russcam Mar 24, 2021
1cfac4e
Extract service bus related values out to constants
russcam Mar 24, 2021
995f266
Add Azure Service Bus to NetCoreAll
russcam Mar 25, 2021
608db10
Fix rebase
russcam Mar 25, 2021
bed17d7
Install terraform for CI
russcam Mar 25, 2021
a4aadd9
install docker first
russcam Mar 25, 2021
5afeb85
Address PR feedback
russcam Mar 30, 2021
52fad70
Address PR feedback round 2
russcam Apr 6, 2021
ee060bf
Capture send and receive messages with Azure Queue Storage
russcam Mar 22, 2021
79a6706
Azure Blob storage integration
russcam Mar 23, 2021
d4cc2de
Azure File share integration
russcam Mar 26, 2021
9c4d66c
Merge branch 'master' into feature/azure-storage
russcam Apr 6, 2021
171d5ef
fix merge commit
russcam Apr 6, 2021
a560b29
Add documentation
russcam Apr 7, 2021
701b1fd
Tidy up
russcam Apr 7, 2021
71ca99a
Address PR feedback
russcam Apr 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ci/linux/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ declare -a projectsToPublish=(
"Elastic.Apm.GrpcClient"
"Elastic.Apm.Extensions.Logging"
"Elastic.Apm.StackExchange.Redis"
"Elastic.Apm.Azure.ServiceBus")
"Elastic.Apm.Azure.ServiceBus"
"Elastic.Apm.Azure.Storage")

for project in "${projectsToPublish[@]}"
do
Expand Down
15 changes: 14 additions & 1 deletion ElasticApmAgent.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
Expand Down Expand Up @@ -137,6 +136,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Apm.Azure.ServiceBu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Apm.Azure.ServiceBus.Sample", "sample\Elastic.Apm.Azure.ServiceBus.Sample\Elastic.Apm.Azure.ServiceBus.Sample.csproj", "{27563B4E-ECB1-4F1B-B9F1-22C2C165B270}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Apm.Azure.Storage", "src\Elastic.Apm.Azure.Storage\Elastic.Apm.Azure.Storage.csproj", "{E9C84C9D-7BEB-49E2-A955-04AD999C4266}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Apm.Azure.Storage.Tests", "test\Elastic.Apm.Azure.Storage.Tests\Elastic.Apm.Azure.Storage.Tests.csproj", "{37BD6194-A47B-4D17-BB9A-642E8909DED9}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\Elastic.Apm.DatabaseTests.Common\Elastic.Apm.DatabaseTests.Common.projitems*{968e1e85-e996-42de-9845-d20dae16165a}*SharedItemsImports = 5
Expand Down Expand Up @@ -342,6 +345,14 @@ Global
{27563B4E-ECB1-4F1B-B9F1-22C2C165B270}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27563B4E-ECB1-4F1B-B9F1-22C2C165B270}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27563B4E-ECB1-4F1B-B9F1-22C2C165B270}.Release|Any CPU.Build.0 = Release|Any CPU
{E9C84C9D-7BEB-49E2-A955-04AD999C4266}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9C84C9D-7BEB-49E2-A955-04AD999C4266}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9C84C9D-7BEB-49E2-A955-04AD999C4266}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9C84C9D-7BEB-49E2-A955-04AD999C4266}.Release|Any CPU.Build.0 = Release|Any CPU
{37BD6194-A47B-4D17-BB9A-642E8909DED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37BD6194-A47B-4D17-BB9A-642E8909DED9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37BD6194-A47B-4D17-BB9A-642E8909DED9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37BD6194-A47B-4D17-BB9A-642E8909DED9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -396,6 +407,8 @@ Global
{1D43C8C5-4116-45C5-9F4B-56C1D926ED29} = {3734A52F-2222-454B-BF58-1BA5C1F29D77}
{D9CC53B2-5F6B-434B-8689-2350F3A9FB2D} = {267A241E-571F-458F-B04C-B6C4DE79E735}
{27563B4E-ECB1-4F1B-B9F1-22C2C165B270} = {3C791D9C-6F19-4F46-B367-2EC0F818762D}
{E9C84C9D-7BEB-49E2-A955-04AD999C4266} = {3734A52F-2222-454B-BF58-1BA5C1F29D77}
{37BD6194-A47B-4D17-BB9A-642E8909DED9} = {267A241E-571F-458F-B04C-B6C4DE79E735}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {69E02FD9-C9DE-412C-AB6B-5B8BECC6BFA5}
Expand Down
76 changes: 76 additions & 0 deletions build/terraform/azure/storage/test_resources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.46.0"
}
}
}

provider "azurerm" {
features {}
}

data "azurerm_client_config" "current" {
}

resource "random_uuid" "variables" {
}

variable "resource_group" {
type = string
description = "The name of the resource group to create"
}

variable "location" {
type = string
description = "The Azure location in which to deploy resources"
default = "westus"
}

variable "storage_account_name" {
type = string
description = "The name of the storage account to create"
}


resource "azurerm_resource_group" "storage_resource_group" {
name = var.resource_group
location = var.location
}

resource "azurerm_storage_account" "storage_account" {
name = var.storage_account_name
resource_group_name = azurerm_resource_group.storage_resource_group.name
location = azurerm_resource_group.storage_resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
enable_https_traffic_only = true
}

# random name to generate for the contributor role assignment
resource "random_uuid" "contributor_role" {
keepers = {
client_id = data.azurerm_client_config.current.client_id
}
}

resource "azurerm_role_assignment" "contributor_role" {
name = random_uuid.contributor_role.result
principal_id = data.azurerm_client_config.current.object_id
role_definition_name = "Contributor"
scope = azurerm_resource_group.storage_resource_group.id
depends_on = [azurerm_storage_account.storage_account]
}


# following role assignment, there can be a delay of up to ~1 minute
# for the assignments to propagate in Azure. You may need to introduce
# a wait before using the Azure resources created.

output "connection_string" {
value = azurerm_storage_account.storage_account.primary_connection_string
description = "The service bus primary connection string"
sensitive = true
}

53 changes: 52 additions & 1 deletion docs/setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ On .NET Core the agent also supports auto instrumentation without any code chang
* <<setup-sqlclient>>
* <<setup-stackexchange-redis>>
* <<setup-azure-servicebus>>
* <<setup-azure-storage>>
* <<setup-general>>

[float]
Expand Down Expand Up @@ -58,10 +59,14 @@ https://www.nuget.org/packages/Elastic.Apm.StackExchange.Redis[**Elastic.Apm.Sta

This packages contains instrumentation to capture spans for commands sent to redis with https://www.nuget.org/packages/StackExchange.Redis/[StackExchange.Redis] package.

https://www.nuget.org/packages/Elastic.Apm.StackExchange.Redis[**Elastic.Apm.Azure.ServiceBus**]::
https://www.nuget.org/packages/Elastic.Apm.Azure.ServiceBus[**Elastic.Apm.Azure.ServiceBus**]::

This packages contains instrumentation to capture transactions and spans for messages sent and received from Azure Service Bus with https://www.nuget.org/packages/Microsoft.Azure.ServiceBus/[Microsoft.Azure.ServiceBus] and https://www.nuget.org/packages/Azure.Messaging.ServiceBus/[Azure.Messaging.ServiceBus] packages.

https://www.nuget.org/packages/Elastic.Apm.Azure.Storage[**Elastic.Apm.Azure.Storage**]::

This packages contains instrumentation to capture spans for interation with Azure Storage with https://www.nuget.org/packages/azure.storage.queues/[Azure.Storage.Queues], https://www.nuget.org/packages/azure.storage.blobs/[Azure.Storage.Blobs] and https://www.nuget.org/packages/azure.storage.files.shares/[Azure.Storage.Files.Shares] packages.
russcam marked this conversation as resolved.
Show resolved Hide resolved


[[setup-dotnet-net-core]]
=== .NET Core
Expand Down Expand Up @@ -403,6 +408,52 @@ A new span is created when there is a current transaction, and when
* one or more messages are sent to a queue or topic.
* one or more messages are scheduled to a queue or a topic.

[[setup-azure-storage]]
=== Azure Storage

[float]
==== Quick start

Instrumentation can be enabled for Azure Storage by referencing https://www.nuget.org/packages/Elastic.Apm.Azure.Storage[`Elastic.Apm.Azure.Storage`] package and subscribing to diagnostic events using one of the subscribers:

. If the agent is included by referencing the `Elastic.Apm.NetCoreAll` package, the subscribers will be automatically subscribed with the agent, and no further action is required.
. If you're using `Azure.Storage.Blobs`, subscribe `AzureBlobStorageDiagnosticsSubscriber` with the agent
+
[source, csharp]
----
Agent.Subscribe(new AzureBlobStorageDiagnosticsSubscriber());
----
. If you're using `Azure.Storage.Queues`, subscribe `AzureQueueStorageDiagnosticsSubscriber` with the agent
+
[source, csharp]
----
Agent.Subscribe(new AzureQueueStorageDiagnosticsSubscriber());
----
. If you're using `Azure.Storage.Files.Shares`, subscribe `AzureFileShareStorageDiagnosticsSubscriber` with the agent
+
[source, csharp]
----
Agent.Subscribe(new AzureFileShareStorageDiagnosticsSubscriber());
----

For Azure Queue storage,

* A new transaction is created when one or more messages are received from a queue
* A new span is created when there is a current transaction, and when a message is sent to a queue

For Azure Blob storage, a new span is created when there is a current transaction and when

* A container is created, enumerated, or deleted
* A page blob is created, uploaded, downloaded, or deleted
* A block blob is created, copied, uploaded, downloaded or deleted

For Azure File Share storage, a new span is crated when there is a current transaction and when

* A share is created or deleted
* A directory is created or deleted
* A file is created, uploaded, or deleted.


[[setup-general]]
=== Other .NET applications

Expand Down
8 changes: 7 additions & 1 deletion docs/supported-technologies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ Automatic instrumentation for the following cloud services
7.0.0+ for Azure.Messaging.ServiceBus
| A new transaction is created for received and
receive deferred messages. A new span is created for sent and scheduled messages if there's a current transaction.
| 1.9
| 1.10

| Azure Storage
| 12.8.0+ for Azure.Storage.Blobs
12.6.0+ for Azure.Storage.Queues and Azure.Storage.Files.Shares
|
| 1.10

|===
Loading