Skip to content

Naming of SNS segment #166

@johankvint

Description

@johankvint

Not sure how to formulate this, but here we go.

So when using SNS client in dotnet with XRay, the subsegment/document is named SimpleNotificationService where as when I use SNS client in node with XRay the subsegment/document is named SNS.

This causes them to be shown in different ways in XRay console where the SNS naming seems to be "correctly" interpreted as a SNS node.

I have two services, one in dotnet and one in node that both publish to the same SNS topic but they show up as separate nodes in the XRay console.

Is the dotnet sns client naming the segment wrong or is there something I need to setup?

dotnet

Screenshot 2020-12-15 at 09 32 07

Code

startup.cs

public IServiceProvider ConfigureServices(IServiceCollection services)
{
    AWSSDKHandler.RegisterXRayForAllServices();
    ...
}

service.cs

using var snsClient = new AmazonSimpleNotificationServiceClient();
...
var publishResponse = await snsClient.PublishAsync(publishRequest);
...

dotnet subsegment

{
    "id": "07ae62c6aff00b02",
    "name": "SimpleNotificationService",
    "start_time": 1608020987.101566,
    "end_time": 1608020987.605851,
    "http": {
        "response": {
            "status": 200,
            "content_length": 294
        }
    },
    "aws": {
        "topic_arn": "arn:aws:sns:eu-west-1:*******",
        "region": "eu-west-1",
        "request_id": "1de5ef77-5263-51da-a03b-b72524580124",
        "operation": "Publish"
    },
    "namespace": "aws"
}

dotnet document

{
    "Document": {
        "id": "02532c1b2e6ab3d0",
        "name": "SimpleNotificationService",
        "start_time": 1608020987.101566,
        "trace_id": "1-5fd873fa-3b8589bd20c663146e34bc7a",
        "end_time": 1608020987.605851,
        "parent_id": "07ae62c6aff00b02",
        "inferred": true,
        "http": {
            "response": {
                "status": 200,
                "content_length": 294
            }
        },
        "aws": {
            "topic_arn": "arn:aws:sns:eu-west-1:*******",
            "region": "eu-west-1",
            "request_id": "1de5ef77-5263-51da-a03b-b72524580124",
            "operation": "Publish"
        },
        "origin": "AWS::SimpleNotificationService"
    },
    "Id": "02532c1b2e6ab3d0"
}

Node

Screenshot 2020-12-15 at 09 31 54

Code

const sns = AWSXRay.captureAWSClient(new SNS());
sns.publish(params, (err, data) => {
    ..
});

Lambda subsegment

{
    "id": "7a4a467dd895a4ac",
    "name": "SNS",
    "start_time": 1608021002.778,
    "end_time": 1608021003.139,
    "http": {
        "response": {
            "status": 200
        }
    },
    "aws": {
        "retries": 0,
        "topic_arn": "arn:aws:sns:eu-west-1:*******",
        "region": "eu-west-1",
        "operation": "Publish",
        "request_id": "01140e4e-1444-56b4-9616-561c620f6e73",
        "resource_names": [
            "arn:aws:sns:eu-west-1:*******"
        ]
    },
    "namespace": "aws"
}

Lambda document

{
    "Document": {
        "id": "066fd5a534027fb8",
        "name": "SNS",
        "start_time": 1608021002.778,
        "trace_id": "1-5fd873fb-4ca832a8ae7d33ac4dba66e8",
        "end_time": 1608021003.139,
        "parent_id": "7a4a467dd895a4ac",
        "inferred": true,
        "http": {
            "response": {
                "status": 200
            }
        },
        "aws": {
            "retries": 0,
            "topic_arn": "arn:aws:sns:eu-west-1:*******",
            "region": "eu-west-1",
            "operation": "Publish",
            "request_id": "01140e4e-1444-56b4-9616-561c620f6e73",
            "resource_names": [
                "arn:aws:sns:eu-west-1:*******"
            ]
        },
        "origin": "AWS::SNS"
    },
    "Id": "066fd5a534027fb8"
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions