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

2868 read sourcemap use go elasticsearch #2897

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

--------------------------------------------------------------------
Dependency: github.com/elastic/go-elasticsearch
Revision: 413583419151bfec42078b5754120bb4d04bd537
License type (autodetected): Apache-2.0
./vendor/github.com/elastic/go-elasticsearch/LICENSE:
--------------------------------------------------------------------
Apache License 2.0


--------------------------------------------------------------------
Dependency: github.com/elastic/go-lumber
Revision: 616041e345fc33c97bc0eb0fa6b388aa07bca3e1
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ To update the dependency to a specific commit or branch run command as following
```
BEATS_VERSION=f240148065af94d55c5149e444482b9635801f27 make update-beats
```
### Go-elasticsearch client Update

It is important to keep the used [go-elasticsearch client](https://github.com/elastic/go-elasticsearch) in sync with the according major version.
We also recommend to use the latest available client for minor versions.
Since APM Server does not yet support go modules, you can update the dependency using govendor, e.g. by running:
```
git clone --branch v7.4.1 https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github.com/elastic/go-elasticsearch/v7
govendor add github.com/elastic/go-elasticsearch/v7/^
mv ./vendor/github.com/elastic/go-elasticsearch/v7/LICENSE ./vendor/github.com/elastic/go-elasticsearch/
```

## Packaging

Expand Down
7 changes: 4 additions & 3 deletions beater/api/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (

"github.com/elastic/beats/libbeat/monitoring"

"github.com/elastic/beats/libbeat/logp"

"github.com/elastic/apm-server/beater/api/asset/sourcemap"
"github.com/elastic/apm-server/beater/api/config/agent"
"github.com/elastic/apm-server/beater/api/intake"
Expand All @@ -39,7 +41,6 @@ import (
"github.com/elastic/apm-server/processor/stream"
"github.com/elastic/apm-server/publish"
"github.com/elastic/apm-server/transform"
"github.com/elastic/beats/libbeat/logp"
)

const (
Expand Down Expand Up @@ -213,12 +214,12 @@ func userMetaDataDecoder(beaterConfig *config.Config, d decoder.ReqDecoder) deco
}

func rumTransformConfig(beaterConfig *config.Config) (*transform.Config, error) {
mapper, err := beaterConfig.RumConfig.MemoizedSourcemapMapper()
store, err := beaterConfig.RumConfig.MemoizedSourcemapStore()
if err != nil {
return nil, err
}
return &transform.Config{
SourcemapMapper: mapper,
SourcemapStore: store,
LibraryPattern: regexp.MustCompile(beaterConfig.RumConfig.LibraryPattern),
ExcludeFromGrouping: regexp.MustCompile(beaterConfig.RumConfig.ExcludeFromGrouping),
}, nil
Expand Down
23 changes: 6 additions & 17 deletions beater/beater.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,20 @@ func checkConfig(logger *logp.Logger) error {
return nil
}

// Creates beater
// New creates a beater instance using the provided configuration
func New(b *beat.Beat, ucfg *common.Config) (beat.Beater, error) {
logger := logp.NewLogger(logs.Beater)
if err := checkConfig(logger); err != nil {
return nil, err
}
beaterConfig, err := config.NewConfig(b.Info.Version, ucfg)
var esOutputCfg *common.Config
if isElasticsearchOutput(b) {
esOutputCfg = b.Config.Output.Config()
}
beaterConfig, err := config.NewConfig(b.Info.Version, ucfg, esOutputCfg)
if err != nil {
return nil, err
}
if beaterConfig.RumConfig.IsEnabled() {
if b.Config != nil && beaterConfig.RumConfig.SourceMapping.EsConfig == nil {
// fall back to elasticsearch output configuration for sourcemap storage if possible
if isElasticsearchOutput(b) {
logger.Info("Falling back to elasticsearch output for sourcemap storage")
beaterConfig.SetSourcemapElasticsearch(b.Config.Output.Config())
} else {
logger.Info("Unable to determine sourcemap storage, sourcemaps will not be applied")
}
}
}
if isElasticsearchOutput(b) &&
(b.Config.Output.Config().HasField("pipeline") || b.Config.Output.Config().HasField("pipelines")) {
beaterConfig.Pipeline = ""
}

bt := &beater{
config: beaterConfig,
Expand Down
Loading