Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

chore: add type definitions for exporter-jaeger#93

Merged
kjin merged 4 commits intocensus-instrumentation:masterfrom
justindsmith:jaeger-exporter-types
Aug 17, 2018
Merged

chore: add type definitions for exporter-jaeger#93
kjin merged 4 commits intocensus-instrumentation:masterfrom
justindsmith:jaeger-exporter-types

Conversation

@justindsmith
Copy link
Copy Markdown
Contributor

The typescript definition files weren't being generated for the exporter-jaeger package because the tsconfig didn't extend from the gts base config.

@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@justindsmith
Copy link
Copy Markdown
Contributor Author

CLA has been signed!

Copy link
Copy Markdown
Contributor

@kjin kjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

};

export type ThriftSpan = {
traceIdLow: any, // tslint:disable-line:no-any
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the any fields actually any? I feel like they can be strings instead for the most part.

parentSpanId: parentSpan,
operationName: span.name,
references: [],
references: [] as any, // tslint:disable-line:no-any
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be casted to whatever the type of references is, currently any[] but hopefully a tighter type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let me dig in and see if I can tighten up the types.

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
@justindsmith
Copy link
Copy Markdown
Contributor Author

Added types for all the ThriftSpan properties.

In doing more testing I found that the JaegerTraceExporterOptions tags weren't being processed correctly as a Tag[] but were handled correctly as a Record<string, TagValue>. I'm making the assumption that the Tag[] was the proper type, so I fixed processing to support that.

Here's what I added in the commit message. I wanted to make sure it was highlighted since it's potentially breaking api:

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach #1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach #2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

Copy link
Copy Markdown
Contributor

@kjin kjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/ nit. I'll make sure to include your comments in the squashed commit message.

return;
}
});
assert.strictEqual(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use assert.ok here.

@kjin
Copy link
Copy Markdown
Contributor

kjin commented Aug 16, 2018

Hi @justindsmith -- This is good to land but I couldn't find your name in the CLA database. Could you retry the CLA signing procedure please?

@justindsmith
Copy link
Copy Markdown
Contributor Author

@kjin I kicked off the process to submit on behalf of my employer (Omnition) and not individually. I thought we had done all the right steps (setup internal google group, add relevant users to that list, get it signed, etc). Is there a separate directory for employer signed contributors?

(I mostly want to make sure that we setup that process correctly for other future contributors from our team.)

@kjin
Copy link
Copy Markdown
Contributor

kjin commented Aug 16, 2018

I see. I don't see it in the list right now, but it seems like it might take some time (a few days -- so hopefully today). I will check back periodically... thanks for the clarification.

@justindsmith
Copy link
Copy Markdown
Contributor Author

Ok great. Thanks. We signed it this past Tuesday morning just for reference. If it doesn't show up we can follow up to see what might be going on.

@kjin kjin added the cla: yes label Aug 17, 2018
@googlebot
Copy link
Copy Markdown

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@googlebot googlebot removed the cla: no label Aug 17, 2018
@kjin
Copy link
Copy Markdown
Contributor

kjin commented Aug 17, 2018

@justindsmith Found Omnition in the database, so we're good to go 👍

@kjin kjin merged commit 5882009 into census-instrumentation:master Aug 17, 2018
@justindsmith justindsmith deleted the jaeger-exporter-types branch August 17, 2018 19:21
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
kjin pushed a commit to kjin/opencensus-node that referenced this pull request Aug 24, 2018
…on#93)

The JaegerTraceExporterOptions accepts `tags` as a Tag array, but was
processing those tags for the process information as if they were an object /
Record instead of a Tag array. This was leading to the process key-value
inside Jaeger to be the array index as key and the value as the key-value
object. We now use the proper key-value information from the input to place
into the process tags.

There were two approaches we could have taken here: 1. To leave the input
as a Tag array and process the input properly in the code or 2. To change
the input to a key-value record / object (Record<string, TagValue), which
would be handled properly by the existing code. We have chosen approach census-instrumentation#1
because a Jaeger process tag CAN support multiple tags with the same key
name, which would not be supported in approach census-instrumentation#2. There is a chance that
(because we were not previously exporting typescript types) users were
passing in a Record format instead of Array, and thus this might be seen
as a breaking change.

A test has been added to validate the process information to ensure proper
format.

Also included are sticter typing for all thrift types, removing all `any`
references and replacing with valid types.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants