Skip to content

Commit

Permalink
Merge pull request #27 from grafana/feat-add-geo-asn
Browse files Browse the repository at this point in the history
feat: Rename geo network Attirbutes
  • Loading branch information
kpelelis authored Jan 16, 2025
2 parents 79b6161 + f9695cc commit d6a2afe
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ The repository consists of
- [OpenAPI specification](./spec/gen/faro.gen.yaml)
- Packages with HTTP Models generated from the OpenAPI specification

## Requirements

- [OpenAPI Codegen](https://github.com/oapi-codegen/oapi-codegen)
- [Python YQ](https://pypi.org/project/yq/)

## Packages

### Go
Expand Down
4 changes: 2 additions & 2 deletions pkg/go/faro.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/translator/faro/internal/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ func GeoToKeyVal(g faroTypes.Geo) *KeyVal {
KeyValAdd(kv, "country_iso", g.CountryISOCode)
KeyValAdd(kv, "subdivision_iso", g.SubdivisionISO)
KeyValAdd(kv, "city", g.City)
KeyValAdd(kv, "connection_type", g.ConnectionType)
KeyValAdd(kv, "carrier", g.Carrier)
KeyValAdd(kv, "asn_org", g.ASNOrg)
KeyValAdd(kv, "asn_id", g.ASNId)
return kv
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/translator/faro/logs_to_faro.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,11 @@ func extractGeoFromKeyVal(kv map[string]string) faroTypes.Geo {
if city, ok := kv["geo_city"]; ok {
geo.City = city
}
if connectionType, ok := kv["geo_connection_type"]; ok {
geo.ConnectionType = connectionType
if asnOrg, ok := kv["geo_asn_org"]; ok {
geo.ASNOrg = asnOrg
}
if carrier, ok := kv["geo_carrier"]; ok {
geo.Carrier = carrier
if asnID, ok := kv["geo_asn_id"]; ok {
geo.ASNID = asnID
}

return geo
Expand Down
6 changes: 4 additions & 2 deletions spec/components/schemas/geo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ components:
city:
type: string
x-go-type-skip-optional-pointer: true
connection_type:
asn_org:
type: string
x-go-type-skip-optional-pointer: true
carrier:
x-go-name: ASNOrg
asn_id:
type: string
x-go-type-skip-optional-pointer: true
x-go-name: ASNID
x-go-type-skip-optional-pointer: true
6 changes: 4 additions & 2 deletions spec/gen/faro.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,14 @@ components:
city:
type: string
x-go-type-skip-optional-pointer: true
connection_type:
asn_org:
type: string
x-go-type-skip-optional-pointer: true
carrier:
x-go-name: ASNOrg
asn_id:
type: string
x-go-type-skip-optional-pointer: true
x-go-name: ASNID
x-go-type-skip-optional-pointer: true
Traces:
type: object
Expand Down

0 comments on commit d6a2afe

Please sign in to comment.